Hibernatables WebSockets API – get tag of current websocket in webSocketMessage handler
I use a Durable Object for a chat-like application. Every client gets an unique id.
I set a tag with the id when accepting the socket.
In the
webSocketMessage
handler I now need to know the id of the socket whose message I’m handling. Is there a way to access the information? Or Maybe the original url parameters?2 Replies
serializeAttachment
! 🎉Today, you can use the
serializeAttachment
as you discovered, there is also a PR that will add a getTags hopefully: https://github.com/cloudflare/workerd/pull/1233
Here's hope it lands GitHub
Add getTags() for websocket hibernation by MellowYarker · Pull Requ...
This method was requested during the hibernation Beta. Previously, if you wanted to get back the tags associated with a hibernatable websocket you would have had to store them in the websocket'...