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

Commit

Permalink
fix(websockets): fix exception when no ws clients connected during re…
Browse files Browse the repository at this point in the history
…build (#616)
  • Loading branch information
fiznool authored and danbucholtz committed Jan 4, 2017
1 parent be3aac1 commit 8685bf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dev-server/notification-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export function createNotificationServer(config: ServeConfig) {

// drain the queue messages when the server is ready
function drainMessageQueue(options = { broadcast: false }) {
let sendMethod = wsServer.send;
let sendMethod = wsServer && wsServer.send;
if (options.hasOwnProperty('broadcast') && options.broadcast) {
sendMethod = wss.broadcast;
}
if (wss.clients.length > 0) {
if (sendMethod && wss.clients.length > 0) {
let msg: any;
while (msg = msgToClient.shift()) {
try {
Expand Down

0 comments on commit 8685bf8

Please sign in to comment.