Im interested in using DO for my chat
Im interested in using DO for my chat app but it's not quite clear to me how to handle multiple concurrent DO connections for a frontend user. My users can be in many chats at once, maybe 20 that are all active. I can't create seperate websocket instances for each one, and if each DO represents one room/conversation, how do I let the frontend subscribe to events in any of those chats? Is there a suggested way of handling this?
8 Replies
DO per chat + DO per client connection?
/ <-WS-> Chat 1
Client <-WS-> User DO <-WS-> Chat 2
\ <-WS-> Chat 3
Client sends requests to User's DO, which subscribes to different chats
Can a DO maintain hibernatable WS connections to other DOs?
unfortunately not, only the server side of websockets can be hibernated
DO-to-DO you can use regular RPC, the only big missing feature there is the "getWebSockets" which you have to reimplenent on top of the DO's storage
Being able to store in-state data in the serialized WS attachment is useful too. Good point on the RPC. Would be super cool if the ability to DO -> DO WS is added in the future
10000%, I'm also waiting for client-side hibernation to eventually become possible, hopefully more people asking for it will help it get prioritized :soontm:
What's the use case there? I have a bunch of stuff that needs further DO implementation and this idea sounds interesting
we have some external nodes that DOs open connections to, and today we have to give the client a "callback" url so it can connect to the DO and hibernate the websocket
I think there's enough interest at this point, we just need more engineers! 😛
Said another way, it's on the higher end of our priorities list, but that list is just really long and growing