Open sunng87 opened 10 months ago
This improvement perfectly fits our use case. While we are at it, if we can specify JS WebSocket API option values like #js {:rejectUnauthorized false}
.
@sunng87 Hi Ning, I hope you're well!
I'll definitely take a look at this when I'm next doing batched work on Sente. If I recall correctly though, the problem blocking a Ring Jetty9 adapter wasn't the WebSocket API - Sente already provided an interface for this that different servers can interop with easily enough.
The problem was on the HTTP (not WebSocket) side. Sente's Ajax mode needs the server to support an async callback or other method, so that Sente can track requests and respond to them on demand.
The Ring Jetty adapter didn't seem to support this use case if I understood correctly? There was some discussion and work on this here and here - though no one at that time was able to provide an adapter that could support Ajax correctly.
As part of that work I added experimental support to Sente for Ring's 3-arity async handlers, but couldn't get a confirmation in the end if that was helpful in Ring Jetty's case. And because of the way Ring's async API works, it's a bit of a nuisance to try test since it's incompatible with the standard (1-arity) case.
So unless I'm misunderstanding something, Sente adopting Ring 1.11 likely won't change anything for any users. The only change I'm anticipating is internal: with Ring providing an official WebSocket interface, server authors don't need to invent their own. If they all use the same WebSocket interface, it means the WebSocket part of any Sente adapter can use the same code. But that's never really been a big issue to be honest, since it's normally only a couple lines of code to adapt.
Hope that makes some sense!
@enspritz Hi there! I don't believe what you're asking for here is related to Ring 1.11's WebSocket API. Could you please create a separate issue and explain in some more detail what your specific use case is?
Thanks!
@enspritz Hi there! I don't believe what you're asking for here is related to Ring 1.11's WebSocket API. Could you please create a separate issue and explain in some more detail what your specific use case is?
Thanks!
Got it!
The newly released Ring 1.11 has standardized websocket APIs for its application: https://github.com/ring-clojure/ring/blob/master/SPEC.md#3-websockets. So I think it is also possible to make sente standardized by adoption of the websocket api.
My https://github.com/sunng87/ring-jetty9-adapter has an implementation of Ring 1.11 for both http and websocket. If we can build sente fully on Ring 1.11, theoretically it should be able to run on any webserver that is compatible.
This also expires #424, we don't need to build an implementation for rj9a specifically any more.