Open ghost opened 8 years ago
Hi!, the component does not serve HTTP content.
You may want to take a look to HttpListener. The only thing is that you will need to run the websocket server and the http server in different ports.
Cheers.
from your wiki, 1. I think I saw that you give additional protocol http (request,response) so I can serve files additional to websocket (same port) ?
I think you have seen the part about custom HTTP negotiation, but it is only to hook some logic in case you want to check for example headers like Cookie
or Origin
and return custom HTTP errors. You cannot use it to serve HTTP content.
You will get nothing. The websocket protocol uses HTTP only for connection establishment and after that it uses its own binary protocol. Even if the browser tries to open a ws connection to the url you put in image.src, it won't try to send a message.
it still would be really nice to add really simple http communication, for example it could be added like this: http://127.0.0.1 will server http files http://127.0.0.1/socket would serve websockets Please consider this :) BIG THUMBS UP for http static files ;)
I understand it is something that seems convenient, but definitely this is something I won't add, since it goes beyond the WebSocket spec.
Cheers.
node.js is giving actually :static file serving and stream I also got some info about in other github, that serving static files(images,..) using :back proxy with IIS
@ellLazar: I was looking for a C# WebSocket server that also had a minimal HTTP server to serve a single-page web app and ended up using https://github.com/sensaura-public/iotweb. Unfortunately, its API does not use async/await (which is why I'd have preferred WebSocketListener).
I also asked this qeustion, on other site how to combine serving websocket and http requests, I have been told it can be achieved by settings reverse Proxy in IIS, and this mechanizm can "steal" the http reuqests. I did not test it, because for me, it's not simple settings.
1. how the web socket serving static files (URL) ? means: in client javascript: image.src=url1 ;
websocket server: getting the url1 request, and sending back to client the binary image.
2. I tested your vtortola websocket with strings,on concurrent users, it worked perfectly.
any code sample, or link will be appreciated.