add socket.io-browserify

This commit is contained in:
Manuel Araoz 2014-08-07 18:55:13 -03:00
parent 4f359c05ca
commit 7c14706e92
2 changed files with 6 additions and 4 deletions

View File

@ -6,7 +6,7 @@ var bitcore = require('bitcore');
var AuthMessage = bitcore.AuthMessage; var AuthMessage = bitcore.AuthMessage;
var util = bitcore.util; var util = bitcore.util;
var extend = require('util')._extend; var extend = require('util')._extend;
var io = require('socket.io-client'); var io = require('socket.io-browserify');
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
/* /*
@ -244,6 +244,7 @@ Network.prototype._setupConnectionHandlers = function() {
preconditions.checkState(this.socket); preconditions.checkState(this.socket);
var self = this; var self = this;
alert('setup');
self.socket.on('connect', function() { self.socket.on('connect', function() {
alert('CONNECTED!'); alert('CONNECTED!');
self.socket.on('disconnect', function() { self.socket.on('disconnect', function() {
@ -295,7 +296,6 @@ Network.prototype.peerFromCopayer = function(hex) {
}; };
Network.prototype.start = function(opts, openCallback) { Network.prototype.start = function(opts, openCallback) {
alert('start');
opts = opts || {}; opts = opts || {};
if (this.started) return openCallback(); if (this.started) return openCallback();
@ -318,7 +318,8 @@ Network.prototype.start = function(opts, openCallback) {
} }
this.socket = io.connect(this.host, { this.socket = io.connect(this.host, {
port: this.port port: this.port,
reconnection: false
}); });
this.socket.emit('subscribe', this.getKey().public.toString('hex')); this.socket.emit('subscribe', this.getKey().public.toString('hex'));
this.socket.emit('sync'); this.socket.emit('sync');

View File

@ -15,7 +15,8 @@
"mocha-lcov-reporter": "0.0.1", "mocha-lcov-reporter": "0.0.1",
"optimist": "^0.6.1", "optimist": "^0.6.1",
"preconditions": "^1.0.7", "preconditions": "^1.0.7",
"sinon": "1.9.1" "sinon": "1.9.1",
"socket.io-browserify": "^0.9.6"
}, },
"scripts": { "scripts": {
"shell": "node shell/scripts/launch.js", "shell": "node shell/scripts/launch.js",