Comments (12)
Any thoughts on aleph-based SockJS server and/or client implementations?
There's already a test suite for the SockJS protocol:
https://github.com/sockjs/sockjs-protocol
That could act as a nice guide for building such implementations, in addition to testing them.
But do you think aleph is well suited for this purpose?
The vert.x folks have implemented a SockJS server in Java (example usage), and it could likely be imported and used in a Clojure project without too much trouble. But perhaps there would be some advantages to an aleph-based implementation?
One of the nice things about SockJS is that a proper client can be used with a plain websocket server; likewise, a SockJS server can be used by a plain websocket client. But the same client and server can also use the non-websocket transports, preserving the same higher-level API, if the other party doesn't support websocket.
from aleph.
I should close this issue since there is a websocket client now, but while we're on the subject: I've been meaning to put together a socket.io implementation for a bit, since that seemed to be the predominant implementation, but I'm by no means an expert in the various protocols floating around. Am I wrong to be conflating SockJS and socket.io? If not, what are the trade offs between the two?
from aleph.
I'm not an expert either, but from hunting around in Google Groups and on blogs, etc. it seems that socket.io is actually rather difficult to implement correctly (and with good performance) given the complexity of the API as it developed over time.
In response to the growing complexity, SockJS was developed as an alternative, and it's now a fairly well advanced polyglot initiative. There's some good info here:
https://github.com/sockjs/sockjs-client
Long story short, SockJS focuses on creating a uniform socket-like API abstraction on top of the various transports, and that's it.
Socket.io goes further and implements an API for things like acknowledgements and broadcasts. While those things are useful, that's where the complexity comes in.
The socket.io team seems to have recognized these problems and there is a derivative project called engine.io:
https://github.com/LearnBoost/engine.io
If I understand correctly, engine.io is supposed to eventually become a dependency of socket.io, providing the lower-level abstractions (i.e. the cross-transport socket-like API). The more complex parts of socket.io can then exist as a layer built on top of engine.io.
from aleph.
There are number of "socket.io vs sockjs" threads and blog posts out there, but I thought this one was pretty interesting, just took me a few minutes to find it again:
https://groups.google.com/forum/#!msg/sockjs/WSIdcY14ciI/B9kot6nS73MJ
from aleph.
Thanks. Like I said, I've been meaning to do something like this for a bit, and I appreciate you bringing the alternative protocol to my attention. I'm going to close this issue, but rest assured that this is near the top of my todo list.
from aleph.
Pardon my confusion, but wasn't websocket-client implemented 5 months ago in https://github.com/ztellman/aleph/blob/perf/src/aleph/http/websocket.clj ?
from aleph.
Yes, which is why I closed the issue (I forgot it was here until just now). Everything discussed here is about something else entirely.
from aleph.
That's what I thought, but wasn't sure. Hope you won't mind, then, if I ask about use examples within a 'lein test' or 'lein midje' context; I've spent the last few days trying to test websockets in my Aleph/Compojure application, and am at a bit of a loss. Was hoping I'd see you in #clojure on IRC; my queries about it the last hour have drawn zero interest from the gallery...
from aleph.
I'm assuming you've seen https://github.com/ztellman/aleph/blob/perf/test/aleph/test/websocket.clj ? I know it's a bit sparse, I'm happy to answer any specific questions you might have.
from aleph.
Yes, I've seen it, thanks; I was hoping to find examples with more options than simply :url. But I'll revisit the example here - thanks again for reminding me of it - and see how far I can go with it.
from aleph.
There aren't really any other options than :url
. The handshake is automatic, and everything else is what you do once you get the websocket channel.
from aleph.
Awesome. You rock, thanks for your help.
from aleph.
Related Issues (20)
- "Possibly confusing dependencies found" regression in 0.6.1 HOT 5
- Add support for `wrap-decompression` middleware HOT 9
- Please bump netty versions because of CVE-2023-34462 HOT 1
- Enable endpoint identification (aka hostname verification) for TLS clients by default? HOT 9
- Look into new Ring websocket support for Aleph HOT 2
- Add write backpressure by checking Channel writability
- Add support for aggregating all inbound data before calling server Ring handler HOT 2
- Default rejected-handler will leak buffers in raw stream HTTP servers HOT 1
- Overhaul docstring formatting for consistency HOT 2
- Hide application protocol config from users with `http-versions`
- Who uses Aleph? Add your name to this, we'd like to know HOT 4
- Reconsider `:aleph/`-namespaced keywords HOT 3
- io.netty.channel.AbstractChannelHandlerContext invokeExceptionCaught HOT 2
- 0.7.0-rc1 is crashing without brotli4j dependency #3530 HOT 2
- Treat de/compression asymmetrically in H2
- Track down potential idle-handler refcount testing leak HOT 11
- Question about single server process using both non-ssl and ssl HOT 3
- Support cancellation of HTTP requests HOT 2
- HTTP client connection pool timeout doesn't free up queue HOT 4
- Drop HTTP client connection pool's acquire queue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aleph.