Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 8685bf8

Browse files
fiznooldanbucholtz
authored andcommitted
fix(websockets): fix exception when no ws clients connected during rebuild (#616)
1 parent be3aac1 commit 8685bf8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dev-server/notification-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export function createNotificationServer(config: ServeConfig) {
2222

2323
// drain the queue messages when the server is ready
2424
function drainMessageQueue(options = { broadcast: false }) {
25-
let sendMethod = wsServer.send;
25+
let sendMethod = wsServer && wsServer.send;
2626
if (options.hasOwnProperty('broadcast') && options.broadcast) {
2727
sendMethod = wss.broadcast;
2828
}
29-
if (wss.clients.length > 0) {
29+
if (sendMethod && wss.clients.length > 0) {
3030
let msg: any;
3131
while (msg = msgToClient.shift()) {
3232
try {

0 commit comments

Comments
 (0)