fix: ensure we close old relay if it's open on connect

This commit is contained in:
Alexis Tyler
2020-12-01 10:26:16 +10:30
parent b87dd1ba08
commit 06766bb10e

View File

@@ -106,6 +106,11 @@ class MothershipService {
if (!apiKey) {
throw new AppError('API key was removed between the file update event and now.');
}
// Kill existing socket before overriding
if (this.relay) {
this.relay.terminate();
}
// Connect to mothership's relay endpoint
this.relay = new WebSocket(this.relayWebsocketLink, ['graphql-ws'], {