Can we lookup instances of DOs from one DO's WebSocket message handler?
I’ve been trying to using DOs for websocket handling, I’ve seen that the message handling function is getting called when I send a message from the front end. However, I also saw that there is no context object being passed to that function. How can I lookup other DO instances in the function that handles incoming websocket messages?
Thanks in advance
3 Replies
The State and Environment of the DO are only passed into the constructor. It is up to you to store them
In your constructor you would want to do something like
Then in your
webSocketMessage()
handler you can use this.state
, this.env
.Thanks a lot!