From dfe28111b0fc113f91ccee20386d2592e1b75e13 Mon Sep 17 00:00:00 2001 From: Eduardo K Date: Wed, 16 Dec 2015 01:52:31 +0200 Subject: [PATCH] Full control on the key option and uid added Key option: needed for socket.io-redis compatibility, because currently socket.io-redis is using `prefix + '#' + namespace + '#'` and `prefix + '#' + namespace + '#' + room + '#'` formats of keys. uid option added to make compatible with socket.io-emitter (1.0.0) --- src/Emitter.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Emitter.php b/src/Emitter.php index 7df0255..f559d15 100644 --- a/src/Emitter.php +++ b/src/Emitter.php @@ -41,8 +41,9 @@ public function __construct($redis = FALSE, $opts = array()) { } $this->redis = $redis; - $this->key = (isset($opts['key']) ? $opts['key'] : 'socket.io') . '#emitter'; - + $this->key = (isset($opts['key']) ? $opts['key'] : 'socket.io#emitter'); + $this->uid = (isset($opts['uid']) ? $opts['uid'] : 'emitter'); + $this->_rooms = array(); $this->_flags = array(); } @@ -117,7 +118,7 @@ public function emit() { } // publish - $packed = msgpack_pack(array($packet, array( + $packed = msgpack_pack(array($this->uid, $packet, array( 'rooms' => $this->_rooms, 'flags' => $this->_flags )));