Updated usage instructions

This commit is contained in:
Matthew Little 2014-01-16 13:59:54 -07:00
parent 7a44219ad8
commit e8da12ad70

View File

@ -44,6 +44,7 @@ npm update
#### Module usage #### Module usage
Initialize a new Stratum object
```javascript ```javascript
var Stratum = require('stratum-pool'); var Stratum = require('stratum-pool');
@ -58,7 +59,11 @@ var stratum = new Stratum({
stratum.on('log', function(text){ stratum.on('log', function(text){
console.log(text); console.log(text);
}); });
```
Create and start new pool with configuration options and authentication function
```javascript
var pool = stratum.createPool({ var pool = stratum.createPool({
name: "Dogecoin", name: "Dogecoin",
@ -93,9 +98,11 @@ var pool = stratum.createPool({
disconnect: false disconnect: false
}); });
}); });
```
Listen to pool events
```javascript
/* /*
'data' object contains: 'data' object contains:
job: 4, //stratum work job ID job: 4, //stratum work job ID
@ -130,7 +137,10 @@ pool.on('share', function(isValidShare, isValidBlock, data){
pool.on('log', function(severity, logKey, logText){ pool.on('log', function(severity, logKey, logText){
console.log(severity + ': ' + '[' + logKey + '] ' + logText); console.log(severity + ': ' + '[' + logKey + '] ' + logText);
}; };
```
Start pool
```javascript
pool.start(); pool.start();
``` ```