-
Notifications
You must be signed in to change notification settings - Fork 852
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
WebSocket support #1
Comments
I think it'll just take little effort to add socket support, as http-proxy already has support to proxy sockets. Do you have an example how you would like to use it? |
Well it would be nice to have similar functionality to grunt-connect. I believe the underlying library you are using supports websockets. But other then that this library is perfect thanks for the work you have
|
Websockets are still unfamiliar terrain for me... Would it be as simple as: So all websocket requests will be proxied to "ws://echo.websocket.org", when using this as middleware? Btw: feel free to create pull requests for any missing feature, or create separate issues for them. |
Well I am by no means all that knowledge about sockets either. But from what I understand we would need to wait for an upgrade event then switch over to use proxy.ws from proxy.web, That being said I have tried it a few different ways and always end up with the socket immediately closing. |
That seems to use http-proxy and works for proxying websockets |
Could you provide a gist of the setup you tried? |
Sure, I moved to use trying to use http-proxy without this library to see if I could get it working but ended up with the same result, I am sure I have missed something. I don't have my code with me but here is a quick setup idea, Hopefully it gives you an idea of what I was trying to do. |
I got a semi-working WebSocket setup with "connect":
Initiate a WS connection in the browser:
With the above code I'm able to
Some pitfalls: Tried browser-sync too: As middleware, I haven't found an elegant way to access the If you want to play with the code, just replace the following function in the middleware:
|
Sorry for the late response. |
No worries. Ended up writing this tiny middleware... :) grunt-connect-proxy uses the same websocket upgrade strategy: Let me know what your findings are. |
Just wondering if this will work with web sockets as well.
The text was updated successfully, but these errors were encountered: