Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal HTTP functionality #13

Open
lobo-tuerto opened this issue Oct 2, 2016 · 6 comments
Open

Minimal HTTP functionality #13

lobo-tuerto opened this issue Oct 2, 2016 · 6 comments

Comments

@lobo-tuerto
Copy link

Hello,

I was wondering if it would be possible (and how difficult) to add minimal HTTP functionality to this server.

The use case would be: to be able to get HTML files from it.

This in turn could allow your Cordova app to serve the initial files to establish a connection, say from your PC to your phone (similar to what the AirDroid app does).

@becvert
Copy link
Owner

becvert commented Oct 3, 2016

Hi @lobo-tuerto

The idea behind this plugin was to have a pure WebSocket server.
But a minimal HTTP functionality wouldn't hurt I guess.
Allowing just HTTP GET to fetch resources (html, scripts, images...) and doing a Connection Upgrade to WebSocket.

I'm seeing two ways to do this:

  • replace implementations (TooTallNateServer with nanohttpd and PocketSocket with CocoaHTTPServer for instance).
    Maybe this could be a new plugin alongside this one but that'd be even more work.
  • or just add the minimal required code.

Serving files from a Phone to a PC is something that interest me as well.
Even though I don't have much time right now I'll try to have a look at this.
I'll keep you updated.

For the time being you can use cordova-plugin-httpd

@lobo-tuerto
Copy link
Author

Well, thanks for the reply!

Yeah I was having a look around during the weekend and came to the conclusion that NanoHTTPD is a pretty good option (for Android) as it already support HTTP + WS.

And I had a look at cordova-plugin-httpd and wrote a quick demo with it (but still missing WS). So I was planning on using both plugins (cordova-plugin-httpd and yours) in the same app, but I think it would be better to just have one that does HTTP & WS.

If you are planning on writing a new plugin I might be able to help, at least in API & feature design.

@becvert
Copy link
Owner

becvert commented Oct 31, 2016

FYI, I will try nanohttp and cocoahttpserver this week or sometime very soon hopefully.
I'm a bit afraid of cocoahttpserver as it seems to be no longer maintained. But maybe it does not matter much.

@becvert
Copy link
Owner

becvert commented Nov 4, 2016

I don't like much nanohttpd's websocket server implementation.
But I just found out WSHttpServer. Looks promising.

@becvert
Copy link
Owner

becvert commented Nov 7, 2016

I've got some bad news. I'm not happy with my tests.
I don't find an easy way to add the minimal http functionality. It's too much work for now.
And as I don't have much time to spend on this, I'm giving up,
Hopefully someone else will step into that issue with a solution.

@lobo-tuerto
Copy link
Author

All right, thanks for trying though!

I don't have much time on my hands these days too, but will see if I can come up with something later.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants