Skip to content

Commit a76f27b

Browse files
Merge pull request cerebral#150 from etienne-dldc/fix/devtool-port-switch
Fix devtools port switch
2 parents cdef67d + 7f7d783 commit a76f27b

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)