mirror of https://github.com/nuxt/nuxt.git
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
|
||||
proxyServer.on('upgrade', (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"))
|
||||
|
|
Loading…
Reference in New Issue