mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-27 19:15:26 +03:00
auto reconnect logging
This commit is contained in:
parent
1a390c8393
commit
a9eb2f2875
@ -22,7 +22,9 @@ const websocketSend = async (type, data) => {
|
||||
let ws = Websocket.get();
|
||||
if (!ws) {
|
||||
console.log("no websocket. creating now...");
|
||||
//set a timeout so it won't proceed for a few seconds after creating the socket? or maybe an wait if possible
|
||||
ws = Websocket.create();
|
||||
//or maybe create it and then send back a failure event so they know to try again?
|
||||
console.log(ws ? "Successfully created websocket" : "Failed to create websocket");
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,10 @@ export const create = () => {
|
||||
});
|
||||
|
||||
ws.on("close", () => {
|
||||
global.websocket = null;
|
||||
console.log(global.websocket);
|
||||
setTimeout(create, 1000);
|
||||
setTimeout(() => {
|
||||
NodeLogging.log(`Auto reconnecting websocket`);
|
||||
create();
|
||||
}, 1000);
|
||||
NodeLogging.log(`Websocket disconnected`);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user