Merge pull request #298 from d3x0r/patch-6

#297 passing options to websocket
This commit is contained in:
Mark Nadal 2016-12-26 22:50:28 -07:00 committed by GitHub
commit 096e224af5
2 changed files with 1 additions and 2 deletions

View File

@ -83,8 +83,6 @@ function Peer (url, options) {
this.setMaxListeners(Infinity);
this.options = options || {};
if( !('wsc' in this.options ) ) this.options.wsc = { protocols: null };
else if( !('protocols' in this.options.wsc) ) this.options.wsc.protocols = null;
// Messages sent before the socket is ready.
this.deferredMsgs = [];

View File

@ -74,6 +74,7 @@ Gun.on('opt', function (context) {
if (sockets[url]) {
return;
}
if (!options.wsc) options.wsc = gun.Back('opt.wsc') || { protocols:null };
var socket = Socket(url, options);
sockets.add(url, socket);