Skip to content

Commit

Permalink
fix(dev-server): prevent crash with Safari 15
Browse files Browse the repository at this point in the history
Safari 15 sends an invalid WebSocket close frame when navigating away
from a page. This causes the dev-server to crash.

STENCIL-46
  • Loading branch information
ltm committed Aug 10, 2021
1 parent e7a6f47 commit ed173cd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dev-server/server-web-socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export function createWebSocket(
ws.isAlive = true;

ws.on('pong', heartbeat);

// ignore invalid close frames sent by Safari 15
ws.on('error', console.error);
});

const pingInternval = setInterval(() => {
Expand Down

0 comments on commit ed173cd

Please sign in to comment.