Can we lookup instances of DOs from one DO's WebSo...
# workers-help
u
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
h
The State and Environment of the DO are only passed into the constructor. It is up to you to store them
m
In your constructor you would want to do something like
Copy code
constructor(state, env) {
    this.state = state;
    this.env = env
  }
Then in your
webSocketMessage()
handler you can use
this.state
,
this.env
.
u
Thanks a lot!