Webpack-dev-server: WebSocket transportMode is missing heartbeat

Created on 27 Jan 2020  路  4Comments  路  Source: webpack/webpack-dev-server

  • Operating System:
  • Node Version: 10.18.1
  • NPM Version: 6.13.4
  • webpack Version: 4.41.5
  • webpack-dev-server Version: 3.9.0
  • Browser: Chrome 79
  • [x] This is a bug
  • [ ] This is a modification request

Expected Behavior

webpack-dev-server sends keep alive heartbeat when using transportMode: 'ws', consistent with sockjs-node to keep the connection open while developing.

Actual Behavior

WebSocket connection times out after a period of inactivity. A page refresh is needed to reconnect.

Create React App related issue: https://github.com/facebook/create-react-app/issues/8091

For Bugs; How can we reproduce the behavior?

Use transportMode: 'ws', connect to running webpack-dev-server instance, and wait for socket to timeout.

Here's the RFC for ping/pong in the WebSocket spec: https://tools.ietf.org/html/rfc6455#section-5.5.2

Most helpful comment

Easy to implement - https://github.com/websockets/ws#how-to-detect-and-close-broken-connections, somebody want to be a champion?

I can do this

All 4 comments

/cc @Loonride

Easy to implement - https://github.com/websockets/ws#how-to-detect-and-close-broken-connections, somebody want to be a champion?

Easy to implement - https://github.com/websockets/ws#how-to-detect-and-close-broken-connections, somebody want to be a champion?

I can do this

Client doesn't require additional code (browser automatically sends ping)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antoinerousseau picture antoinerousseau  路  3Comments

gimmi picture gimmi  路  3Comments

hnqlvs picture hnqlvs  路  3Comments

eyakcn picture eyakcn  路  3Comments

daryn-k picture daryn-k  路  3Comments