From 4c6a7589a8ee996efd70b41e0ebe5a52b315fc55 Mon Sep 17 00:00:00 2001 From: Greg Smith Date: Wed, 26 Mar 2014 11:10:54 -0400 Subject: [PATCH] add socket.io options to cloak.run --- src/client/cloak.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/client/cloak.js b/src/client/cloak.js index f10a922..52da824 100644 --- a/src/client/cloak.js +++ b/src/client/cloak.js @@ -1,5 +1,5 @@ /* cloak client */ -/* global module,console */ +/* global module,define,require */ (function(global, factory) { @@ -89,11 +89,21 @@ } }, - run: function(url) { + run: function(url, options) { - socket = io.connect(url, { + if (options === undefined) { + options = {}; + } + + var ioOptions = { 'force new connection': true - }); + }; + + if (options['socket.io']) { + ioOptions = _.extend(ioOptions, options['socket.io']); + } + + socket = io.connect(url, ioOptions); socket.on('error', function(data) { cloak._trigger('cloak-error', data);