Skip to content

Commit 1011ab3

Browse files
refactor(cluster): allow to call onMessage() with a cluster response
The Redis adapter is currently the only adapter which makes a distinction between publishing messages (one channel for all) and responses (one channel for each node).
1 parent 0e23ff0 commit 1011ab3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/cluster-adapter.ts

+13
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,19 @@ export abstract class ClusterAdapter extends Adapter {
299299
break;
300300
}
301301

302+
// @ts-ignore
303+
case MessageType.BROADCAST_CLIENT_COUNT:
304+
// @ts-ignore
305+
case MessageType.BROADCAST_ACK:
306+
// @ts-ignore
307+
case MessageType.FETCH_SOCKETS_RESPONSE:
308+
// @ts-ignore
309+
case MessageType.SERVER_SIDE_EMIT_RESPONSE:
310+
// extending classes may not make a distinction between a ClusterMessage and a ClusterResponse payload and may
311+
// always call the onMessage() method
312+
this.onResponse(message);
313+
break;
314+
302315
default:
303316
debug("unknown message type: %s", message.type);
304317
}

0 commit comments

Comments
 (0)