mirror of
https://github.com/filecoin-project/slate.git
synced 2024-12-27 11:03:23 +03:00
testing websockets disconnecting
This commit is contained in:
parent
884d524564
commit
856e4c66e2
@ -19,7 +19,13 @@ const websocketSend = async (type, data) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const ws = Websocket.get();
|
||||
let ws = Websocket.get();
|
||||
if (!ws) {
|
||||
console.log("no websocket. creating now...");
|
||||
ws = Websocket.create();
|
||||
console.log(ws);
|
||||
}
|
||||
|
||||
const encryptedData = await Utilities.encryptWithSecret(
|
||||
JSON.stringify(data),
|
||||
Environment.PUBSUB_SECRET
|
||||
|
@ -20,7 +20,7 @@ export const create = () => {
|
||||
perMessageDeflate: false,
|
||||
});
|
||||
|
||||
ws.on("ping", function() {
|
||||
ws.on("ping", function () {
|
||||
clearTimeout(this.pingTimeout);
|
||||
|
||||
this.pingTimeout = setTimeout(() => {
|
||||
@ -33,6 +33,7 @@ export const create = () => {
|
||||
});
|
||||
|
||||
ws.on("close", () => {
|
||||
console.log(global.websocket);
|
||||
console.log("Websocket disconnected");
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user