We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4649a7f commit b4b9c59Copy full SHA for b4b9c59
packages/vite/src/node/server/ws.ts
@@ -8,6 +8,7 @@ import WebSocket from 'ws'
8
import { ErrorPayload, HMRPayload } from 'types/hmrPayload'
9
import { ResolvedConfig } from '..'
10
import { isObject } from '../utils'
11
+import { Socket } from 'net'
12
export const HMR_HEADER = 'vite-hmr'
13
14
export interface WebSocketServer {
@@ -30,7 +31,7 @@ export function createWebSocketServer(
30
31
wss = new WebSocket.Server({ noServer: true })
32
wsServer.on('upgrade', (req, socket, head) => {
33
if (req.headers['sec-websocket-protocol'] === HMR_HEADER) {
- wss.handleUpgrade(req, socket, head, (ws) => {
34
+ wss.handleUpgrade(req, socket as Socket, head, (ws) => {
35
wss.emit('connection', ws, req)
36
})
37
}
0 commit comments