-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ring handler for Websockets #41
Comments
For now WebSocket paths were defined separately because Jetty's API uses different handler for WebSocket and regular HTTP servlet requests. I'll look into other implementation to see possible solution. |
One idea might be to just chain the handlers internally. It looks like it's possible to update the In the example above |
+1 for this. It seems there is no way to use dynamic routing for WebSockets under the current implementation? |
I actually ended up making an implementation of that here. |
Ring 2.0 seems to have such a section for websockets https://github.com/ring-clojure/ring/blob/2.0/SPEC-2.md#3-websockets |
yeah, looks like that's going to be part of the spec going forward |
It wuld be really great if jetty couldhave the same api for websockets as httpkit, ... |
Actually I think you can use the same ring app for both main app and websocket path, too. Just keep in mind your websocket path in the route should be consistent with the path specified in (defroute app
(GET "/" [] {:status 200})
(ANY "/path1" [req]
{:on-message (fn [ch text] (send! ch text))}))
(run-jetty app {:port 8080 :websockets {"/path1" app}}) |
This is supported via #59 finally. |
Are there any plans to support a standard Ring handler for Websockets as seen in Immutant and HTTP Kit. For example, something along the lines of:
This would allow ws routes to be defined the same way regular routes are defined via standard routing libraries. The ws routes would then be able to share all the middleware such as sessions and authentications with the other routes in the application.
The text was updated successfully, but these errors were encountered: