meteor-feature-requests
meteor-feature-requests copied to clipboard
Replace SockJS with something that works better in non-browser environments
Migrated from: meteor/meteor#8621 Related: #27
@hwillson in meteor/meteor#8621:
As part of the Meteor support for non browser environment discussions in #8615, it was suggested (and PR encouraged) that a replacement for SockJS should be found (if possible/advantageous). Since there will likely be a lot of discussion about a potential replacement, I'm creating this new issue to track that work (and to make sure the other items in #8615 aren't drowned out).
One thing to note - finding a SockJS replacement will impact several other open issues. I'll list them here to make sure anyone thinking about working on those issues is given a heads up about a potential replacement.
Open SockJS (related) issues: #1285, #4114, #4897, #6389, #6719, #8254, #8317
Relevant bits extracted from #8615:
(from https://github.com/meteor/meteor/issues/8615#issuecomment-295925903)
Replace SockJS with something that works better in non-browser environments. Unfortunately, socketio-1.7.2.js is much larger than sockjs-0.3.4.js (159KB vs 78.3KB), and I don't think we can justify increasing the size of ddp-client by that much. Could we use something smaller, like https://www.npmjs.com/package/ws, instead?
In particular, we would be happy to review a pull request to replace SockJS with a smaller library, since that fits nicely into #8327.
(from https://github.com/meteor/meteor/issues/8615#issuecomment-295960575)
As far as I know WS doesn't use polling, only WebSockets, so I wouldn't consider it to be the ideal solution.
I see SockJS as a polyfill for websockets. Instead of replacing it, I think it would be better if we just extend the polyfill with support for other options.
What exactly are issues with SockJS for non-browser environments?
Some arguments against socket.io and for sock.js: https://github.com/rethinkdb/horizon/issues/413
Please see https://github.com/meteor/meteor-feature-requests/issues/116. If SockJS is import-able, then adding a transport is usually not difficult, and I have done so in several non-browser environments (with Meteor) including Atomic Game Engine. I just had to hack the files to make SockJS a global.
Any updates?
I haven't upgraded my hacked version in a while. I believe it probably still isn't exposed.
Why is Meteor still using 0.3.4 of SockJS, could we at least update it to a more recent version?
For example, the ability to add query strings to SockJS URLs has been supported for 4 years, but with Meteor you still can't use it.
Is this a difficult migration?
@benjamn is this repo still the correct place to discuss this?
@perbergland Yes
Just an update, linking here some recent PR related to SockJS: https://github.com/meteor/meteor/pull/11416