Closed evanshortiss closed 5 years ago
Hey, you were so close 😉
The underlying socket is available to any & all event handlers. The WebSocket is an event emitter, so the current, up-to-date WebSocket
instance is always available as ev.target
. You can save that reference and do whatever you'd like with it!
There are a few examples scattered across the issues; https://github.com/lukeed/sockette/issues/12#issuecomment-365170978, https://github.com/lukeed/sockette/issues/31#issuecomment-406741545, and https://github.com/lukeed/sockette/issues/18
Hope that helps!
Man I need to RTFM next time and not just the Example
code. Thanks! 👍
No worries!
In an application I'm working on I'd like to check that the socket has flushed data. This can be done using
socket.bufferedAmount
according to this SO postCould this library support a function to check this, or simply expose the underlying socket object for these use cases, e.g: