-
Notifications
You must be signed in to change notification settings - Fork 490
Open
Description
I have multiple socket io namespaces.
on client joins a specific namespace, the client will join a room under the namespace, after that server will send the client a message. Code:
ns!.on("connection", async (socket) => {
console.log("A client connected!", socket.id);
socket.join('Room 1')
ns!.to(socket.id).emit("join_room_resp", {
response: `Joined Room 1 successfully!`,
});
});
Then I put some console.log
in Redis adapter util under SPUBLISH and SSUBSCRIBE
export function SSUBSCRIBE(
redisClient: any,
channel: string,
handler: (rawMessage: Buffer, channel: Buffer) => void
) {
console.log(`>>>>>>SSUBSCRIBE ${channel}`);
// ....
}
export function SPUBLISH(
redisClient: any,
channel: string,
payload: string | Uint8Array
) {
console.log(`SPUBLISH ${channel} ${payload}`);
// ....
}
Output shows:
>>>>>>SSUBSCRIBE test.socket.io#/adasd#Room 1#
SPUBLISH test.socket.io#/adasd# {"type":3,"data":{"packet":{"type":2,"data":["join_room_resp",{"status":1,"room":"Room 1","response":"Joined Room 1 successfully!"}]},"opts":{"rooms":["x0jrTAQqgtKi7KDmAAAB"],"except":[],"flags":{}}},"uid":"19183eaa9eddca93","nsp":"/adasd"}
as shown above, after the user joins the channel, it subscribes Redis at channel test.socket.io#/adasd#Room 1#
, but the message after that is published to channel test.socket.io#/adasd#
which is wrong, and it lead to message never gets received
Metadata
Metadata
Assignees
Labels
No labels