mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
fix ws error/reconnect ordering
This commit is contained in:
parent
9ca6e59d32
commit
cdfe87c2b6
6
gun.js
6
gun.js
@ -1718,10 +1718,10 @@
|
||||
var url = peer.url.replace(/^http/, 'ws');
|
||||
var wire = peer.wire = new opt.WebSocket(url);
|
||||
wire.onclose = function(){
|
||||
opt.mesh.bye(peer);
|
||||
reconnect(peer);
|
||||
opt.mesh.bye(peer);
|
||||
};
|
||||
wire.onerror = function(error){
|
||||
wire.onerror = function(err){
|
||||
reconnect(peer);
|
||||
};
|
||||
wire.onopen = function(){
|
||||
@ -1732,7 +1732,7 @@
|
||||
opt.mesh.hear(msg.data || msg, peer);
|
||||
};
|
||||
return wire;
|
||||
}catch(e){}}
|
||||
}catch(e){ opt.mesh.bye(peer) }}
|
||||
|
||||
setTimeout(function(){ !opt.super && root.on('out', {dam:'hi'}) },1); // it can take a while to open a socket, so maybe no longer lazy load for perf reasons?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user