Skip to content

Commit

Permalink
README.md: Document that wds transportMode option must be set to ws
Browse files Browse the repository at this point in the history
Default import does not work otherwise as the following error is reported
in the js console:

Error during WebSocket handshake: Unexpected response code: 200
  • Loading branch information
anlambert authored and Svish committed May 20, 2021
1 parent c25b44c commit 776a9b0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ import 'cypress-hmr-restarter/gatsby';
When using the [Cypress Test Runner](https://docs.cypress.io/guides/core-concepts/test-runner.html) (`cypress open`), after the window has loaded, it will try to connect and listen for events. When an event signifying a change has happened, it will first try clicking the stop button, and then, after a short delay, it will click the restart button.

- The default import connects to the [`webpack-dev-server`](https://www.npmjs.com/package/webpack-dev-server) websocket at either `<hmrUrl>` or `ws://<baseUrl>/sockjs-node` (`wss:` if `https:`), and listens for messages with the type `invalid`.
**IMPORTANT:** You need to ensure that [`transportMode`](https://webpack.js.org/configuration/dev-server/#devservertransportmode) option of `webpack-dev-server` is set to `ws` for the feature to work.

- The gatsby import connects to the [`webpack-hot-middleware`](https://www.npmjs.com/package/webpack-hot-middleware) event source at either `<hmrUrl>` or `<baseUrl>/__webpack_hmr`, and listens for messages with the action `built`.

0 comments on commit 776a9b0

Please sign in to comment.