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

Ring 1.11 adoption #443

Open
sunng87 opened this issue Jan 19, 2024 · 4 comments
Open

Ring 1.11 adoption #443

sunng87 opened this issue Jan 19, 2024 · 4 comments
Assignees

Comments

@sunng87
Copy link

sunng87 commented Jan 19, 2024

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.

@enspritz
Copy link

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}.

@ptaoussanis
Copy link
Member

@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!

@ptaoussanis ptaoussanis self-assigned this Jan 26, 2024
@ptaoussanis
Copy link
Member

@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
Copy link

@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!

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

No branches or pull requests

3 participants