Just realized that I'm not reusing the websocket, and relying on the onclose event to clean up, also on the onopen to send messages.
This should just be opened once on a page, and then reused. And instead of using onopen to send the message probably pass whatever connect function is made a callback that will send the message onopen or if we are already open, or queue it if we are connecting?
Just realized that I'm not reusing the websocket, and relying on the onclose event to clean up, also on the onopen to send messages.
This should just be opened once on a page, and then reused. And instead of using onopen to send the message probably pass whatever connect function is made a callback that will send the message onopen or if we are already open, or queue it if we are connecting?