From 0811dec65cc896e5d213f05158f20a96014b917e Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Wed, 14 Aug 2013 17:21:08 -0700 Subject: [PATCH] Update server --- src/js/ripple/server.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/ripple/server.js b/src/js/ripple/server.js index be047132..536fb6b8 100644 --- a/src/js/ripple/server.js +++ b/src/js/ripple/server.js @@ -14,7 +14,7 @@ var utils = require('./utils'); function Server(remote, opts) { EventEmitter.call(this); - if (typeof opts !== 'object' || typeof opts.url !== 'string') { + if (typeof opts !== 'object') { throw new Error('Invalid server configuration.'); } @@ -22,6 +22,9 @@ function Server(remote, opts) { this._remote = remote; this._opts = opts; + this._host = opts.host; + this._port = opts.port; + this._secure = typeof opts.secure === Boolean ? opts.secure : true; this._ws = void(0); this._connected = false; this._should_connect = false; @@ -30,6 +33,9 @@ function Server(remote, opts) { this._retry = 0; this._requests = { }; + this._opts.url = (opts.secure ? 'wss://' : 'ws://') + + [ opts.host, opts.port ].join(':'); + this.on('message', function(message) { self._handle_message(message); });