pocesar / node-stratum

Stratum protocol server and client for Node.js
GNU General Public License v2.0
162 stars 68 forks source link

Stratum client - object constructor has no method 'on' #10

Closed epsicoin closed 9 years ago

epsicoin commented 9 years ago

Hello,

I used this in my code

var stratum = require('stratum'); var Client = stratum.Client; var client = Client.create(); client.on('mining.error', function(msg, socket) { console.log(msg); });

and when i launch i throw this error.

Any idea ?

pocesar commented 9 years ago
var stratum = require('stratum');
var client = stratum.Client.$create();
client.on('mining.error', function(msg, socket) {
   console.log(msg);
});
epsicoin commented 9 years ago

Thanks for your reply, but it's strange, i still got the same issue

epsicoin commented 9 years ago

TypeError: Object #<constructor> has no method 'on' at Object.<anonymous>

pocesar commented 9 years ago

ah my bad, EventEmitter3 1.x had a breaking change, I'll have to update the lib. for now, change the package.json manually to use EventEmitter3 0.x or edit the lib/base.js file from

}).$implement(require('eventemitter3').EventEmitter, true);

to

}).$implement(require('eventemitter3'), true);
epsicoin commented 9 years ago

Works better Thanks !

pocesar commented 9 years ago

I've updated the code and released as 0.2.4, thanks for the report. It won't work for node 0.12 for now because the json-rpc2 dependency is broken on 0.12