Skip to content

Commit

Permalink
[docs] Add a note about error handling (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne authored Jan 12, 2017
1 parent 65aba35 commit c003a4e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ setInterval(function(){
// Different constructor options.

//1. Initialize with host:port string
var io = require('socket.io-emitter')("loaclhost:6379")
var io = require('socket.io-emitter')("localhost:6379")
// 2. Initlize with host, port object.
var io = require('socket.io-emitter')({ host: '127.0.0.1', port: 6379 });
// 3. Can use other node_redis compatible client eg; ioredis.
Expand All @@ -43,6 +43,20 @@ var io = require('socket.io-emitter')(Cluster);

```

## Error handling

Access the `redis` to subscribe to its `error` event:

```js
var emitter = require('socket.io-emitter')("localhost:6379");

emitter.redis.on('error', onError);

function onError(err){
console.log(err);
}
```

## API

### Emitter(client[, opts])
Expand Down

0 comments on commit c003a4e

Please sign in to comment.