Fix non-terminating node scripts due to reconnect interval

This commit is contained in:
Fabian 2020-12-31 19:14:31 -06:00
parent a28bad9c50
commit 00cf97fbf6

View file

@ -73,6 +73,11 @@ NetworkAdapter.prototype.destroy = function()
NetworkAdapter.prototype.connect = function()
{
if(typeof WebSocket === "undefined")
{
return;
}
if(this.socket)
{
var state = this.socket.readyState;
@ -93,16 +98,7 @@ NetworkAdapter.prototype.connect = function()
this.last_connect_attempt = Date.now();
try
{
this.socket = new WebSocket(this.url);
}
catch(e)
{
this.handle_close(undefined);
return;
}
this.socket = new WebSocket(this.url);
this.socket.binaryType = "arraybuffer";
this.socket.onopen = this.handle_open.bind(this);