mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix websocket upgrade for nuxt devtools
This commit is contained in:
parent
b027af30d7
commit
00d2b90ea0
@ -47,7 +47,14 @@ const proxyServer = http.createServer((req, res) => {
|
|||||||
|
|
||||||
// upgrade client connection to websocket if requested
|
// upgrade client connection to websocket if requested
|
||||||
proxyServer.on('upgrade', (req, socket, head) => {
|
proxyServer.on('upgrade', (req, socket, head) => {
|
||||||
proxySocketIO.ws(req, socket, head)
|
const isSocketIo = req.url.startsWith("/socket.io")
|
||||||
|
|
||||||
|
// choose backend depending on url
|
||||||
|
if (isSocketIo) {
|
||||||
|
proxySocketIO.ws(req, socket, head)
|
||||||
|
} else {
|
||||||
|
proxyNuxt.ws(req, socket, head)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
proxyServer.listen(4000, () => console.log("proxy is listening"))
|
proxyServer.listen(4000, () => console.log("proxy is listening"))
|
||||||
|
Loading…
Reference in New Issue
Block a user