lukeed / sockette

The cutest little WebSocket wrapper! 🧦
MIT License
2.45k stars 81 forks source link

Possible to get WebSocket instance? #54

Closed yoonwaiyan closed 5 years ago

yoonwaiyan commented 5 years ago

Hi, I saw from your README that WebSocket object is available in each EventListener, but is there a way to access it outside of event listeners? Would like to get the state of WebSocket to determine whether to stop an interval to ping the websocket server, thanks.

lukeed commented 5 years ago

Hey!

This has been answered a few times. Because it is available as the event target, you just save a reference manually into a side-effect variable.

Please see the additional answers linked here: https://github.com/lukeed/sockette/issues/43#issuecomment-469861917

Hope that helps!