socket.io+browserify=😻

This commit is contained in:
Manuel Araoz 2014-08-07 19:34:48 -03:00
commit 0ceaea9f95

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-browserify'); var io = require('socket.io-client');
var preconditions = require('preconditions').singleton(); var preconditions = require('preconditions').singleton();
/* /*
@ -238,7 +238,6 @@ 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() {
@ -307,9 +306,8 @@ Network.prototype.start = function(opts, openCallback) {
this.socket.removeAllListeners(); this.socket.removeAllListeners();
} }
this.socket = io.connect(this.host, { this.socket = io.connect(this.host + ':' + this.port, {
port: this.port, //reconnection: false,
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');