From c003a4e887da7ce1a7a01ed505d6756aba8cd64d Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Thu, 12 Jan 2017 10:57:17 +0100 Subject: [PATCH] =?UTF-8?q?[docs]=C2=A0Add=20a=20note=20about=20error=20ha?= =?UTF-8?q?ndling=20(#45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index f0e38e7..e73ed54 100644 --- a/Readme.md +++ b/Readme.md @@ -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. @@ -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])