tavendo/AutobahnJS — pull request #4 by igorw (2012-05-13 16:06:15+00:00)
Title: Factory for creating WebSocket connection (can be replaced)

I was working on running WAMP over SockJS. It's not really possible right now, as subprotocols are missing from SockJS (it's a planned feature). I had to hack in support for them.

On the AutobahnJS side I ran into issues because it tries to create the WebSocket instance itself with no way to change the creation. This PR allows the creation to be customized.

Example:

ab._construct = SockJS;
ab.connect('http://localhost:8080/broadcast', function (sess) {
sess.call('isEven', 1).then(ab.log);
sess.call('isEven', 2).then(ab.log);
});