Skip to content

Commit

Permalink
add socket.io options to cloak.run
Browse files Browse the repository at this point in the history
  • Loading branch information
incompl committed Mar 26, 2014
1 parent a07f212 commit 4c6a758
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/client/cloak.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* cloak client */
/* global module,console */
/* global module,define,require */

(function(global, factory) {

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4c6a758

Please sign in to comment.