I know this isn't an issue or pull request but I don't know where else to ask this question. Sorry.
Normally with my websocket connection I, after a connection is opened, there is various amounts of data that I need to send to the server. I usually do this:
ws = new WebSocket(url);
ws.onopen = function()
{
ws.send('data to be sent');
};
That way, I only attempt to send my data after the connection has definitely been made.
However, when I use Reconnecting WebSocket, since it already has the onopen method defined, I assume I shouldn't "redefine" onopen, right? If I can't redefine onopen then what is the best way for me to recognize when the connection has been established so I can do stuff? Use a setInterval() method and check periodically if the connection is made?
I know this isn't an issue or pull request but I don't know where else to ask this question. Sorry.
Normally with my websocket connection I, after a connection is opened, there is various amounts of data that I need to send to the server. I usually do this:
That way, I only attempt to send my data after the connection has definitely been made.
However, when I use Reconnecting WebSocket, since it already has the
onopen
method defined, I assume I shouldn't "redefine"onopen
, right? If I can't redefineonopen
then what is the best way for me to recognize when the connection has been established so I can do stuff? Use asetInterval()
method and check periodically if the connection is made?