Specified protocol was not requested by the client.

背景:

在调试webSocket时,服务器端出现该错误信息,具体错误如下:

C:\Users\Administrator\WebstormProjects\websocket-demo\node_modules\websocket\lib\WebSocketRequest.js:289
             throw new Error('Specified protocol was not requested by the client.');
             ^
 Error: Specified protocol was not requested by the client.
     at WebSocketRequest.accept (C:\Users\Administrator\WebstormProjects\websocket-demo\node_modules\?[4mwebsocket?[24m\lib\WebSocketRequest.js:289:19)
     at WebSocketServer. (C:\Users\Administrator\WebstormProjects\websocket-demo\index.js:29:30)
 ?[90m    at WebSocketServer.emit (events.js:310:20)?[39m
     at WebSocketServer.handleUpgrade (C:\Users\Administrator\WebstormProjects\websocket-demo\node_modules\?[4mwebsocket?[24m\lib\WebSocketServer.js:217:14)
 ?[90m    at Server.emit (events.js:310:20)?[39m
 ?[90m    at onParserExecuteCommon (_http_server.js:642:14)?[39m
 ?[90m    at onParserExecute (_http_server.js:583:3)?[39m
 [nodemon] app crashed - waiting for file changes before starting…
webSocket

解决办法:

如果觉得文章有帮助到你,可以扫描以下二维码
   请本文作者 喝一杯
pay_weixin pay_weixin

发表评论

电子邮件地址不会被公开。 必填项已用*标注