From e3ead04ab1efe189a5579cd93065beff1d5dde8c Mon Sep 17 00:00:00 2001 From: Dougley Date: Sun, 9 Apr 2017 17:39:16 +0200 Subject: [PATCH] Update Support wildcard subscriptions and drop array usage for sharding information --- Bezerk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bezerk.js b/Bezerk.js index c41694a..bec6cc1 100644 --- a/Bezerk.js +++ b/Bezerk.js @@ -83,7 +83,7 @@ function process (socket, message) { if (msg.shard) { Logger('Listener event defined a shard, trying to find it and send the message.') for (let shard of shards) { - if (shard.shardInfo[0] === msg.shard) { + if (shard.shardInfo === msg.shard) { Logger('Shard found, sending payload.') shard.send(JSON.stringify(msg)) } @@ -106,7 +106,7 @@ function process (socket, message) { } else { Logger('Request accepted, attempting to send data to subscribed listeners.') for (let listener of receivers) { - if (listener.subscriptions.indexOf(msg.op) > -1 && listener.readyState === 1) { + if (listener.subscriptions.indexOf(msg.op) > -1 || listener.subscriptions.indexOf('*') > -1 && listener.readyState === 1) { Logger('Sending data.') listener.send(JSON.stringify(msg)) }