Skip to content

Commit 7f7d783

Browse files
committed
fix(overmind-devtools): fix port switch
1 parent 3184fe0 commit 7f7d783

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/node_modules/overmind-devtools/backend/ConnectionManager.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ class ConnectionManager {
2727
this.ws.send(JSON.stringify(payload))
2828
}
2929
connect(_, port) {
30-
if (this.wss) {
30+
if (this.port === port) {
3131
return
3232
}
3333

34-
this.wss = new WebSocketServer({ port: Number(port) })
34+
if (this.wss) {
35+
this.wss.close()
36+
}
37+
38+
this.port = Number(port)
39+
this.wss = new WebSocketServer({ port: this.port })
3540
this.wss.on('connection', this.onConnection)
3641
this.wss.on('error', this.onError)
3742
}

0 commit comments

Comments
 (0)