mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
5d779a0289
After discussion, I added falling back to fetch based pinging when the WebSocket fails to connect. I also added an example of how to proxy the onDemandEntries WebSocket when using a custom server. Fixes: #6296 |
||
---|---|---|
.. | ||
pages | ||
genSSL.sh | ||
next.config.js | ||
package.json | ||
README.md | ||
server.js |
Custom server with Proxying onDemandEntries WebSocket
How to use
Using create-next-app
Execute create-next-app
with Yarn or npx to bootstrap the example:
npx create-next-app --example custom-server-proxy-websocket custom-server-proxy-websocket
# or
yarn create next-app --example custom-server-proxy-websocket custom-server-proxy-websocket
Download manually
Download the example:
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/custom-server-proxy-websocket
cd custom-server-proxy-websocket
Install it and run:
npm install
npm run ssl
npm run dev
# or
yarn
yarn ssl
yarn dev
The idea behind the example
The example shows how you can use SSL with a custom server and still use onDemandEntries WebSocket from Next.js using node-http-proxy and ExpressJS.