Does Meteor use SockJS as it's main browser-server communications mechanism?
Asked Answered
W

1

6

I noticed the Meteor stream package here contains SockJS: https://github.com/meteor/meteor/tree/master/packages/stream

Based on some commit messages, I'g guess Meteor use SockJS polling as it's main browser-server communications mechanism. Is that correct?

Wesle answered 12/4, 2012 at 17:6 Comment(0)
I
2

Looks like it. But it doesn't use websockets or streaming as commented in the code right now:

self.socket = new SockJS(self.url, undefined, { debug: false, protocols_whitelist: [        
    **// only allow polling protocols. no websockets or streaming.        
    // streaming makes safari spin, and websockets hurt chrome.**        
    'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling'      ]});
Intra answered 12/4, 2012 at 18:45 Comment(5)
Too bad browsers aren't ready for WebSocket. Looks like we're waiting for Safari, Opera and IE 10 which will be out soon. WebSocket should be the default and iframe the polyfill.Brook
Websockets should be enabled in current dev meteor, see: github.com/meteor/meteor/pull/69Quadragesima
To other googlers, you can check the status here: github.com/meteor/meteor/blob/master/packages/stream/… by searching "new SockJS" FTR, It's still the same as the aboveHeretical
As a followup, adding 'websocket' to that list enables websockets use. This lowers latency a ton but makes it a bit less admissible to other browsers as mentioned in the other comments. For you lazy c/p monkeys: self.socket = new SockJS(self.url, undefined, { debug: false, protocols_whitelist: [ 'websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling' ]});Norvol
@DevinGRhode: The URL to stream_client.js has changed to github.com/meteor/meteor/blob/master/packages/livedata/… ; update comment?Taconite

© 2022 - 2024 — McMap. All rights reserved.