How do I get the client id? #481
Unanswered
CovertCode
asked this question in
Q&A
Replies: 1 comment 5 replies
-
You give it whatever ID you want, and store it to look up later however you want store the ws by ID in a Map: const wsMap=new Map()
open:ws=>wsMap.set(id,ws)
close:ws=>wsMap.delete(id)
wsMap.get(id).send(message) or use Subscribe / Publish by ID: open:ws=>ws.subscribe(id)
app.publish(id,message) |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say there are 10 clients connected to my socket server and I want to send a message to specific client from my backend. So for this I think there's need of client id or client address. But I checked the documentation there's no mention of client id of list of connected clients.
Can someone give me directions of how to achieve this? I jumped directly to uWebSocket and I'm new to this.
Beta Was this translation helpful? Give feedback.
All reactions