Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_modules/wsc/node_modules/ws/lib/WebSocket.js:721:12 #5

Open
qdhaiqiang opened this issue Feb 18, 2019 · 2 comments
Open

node_modules/wsc/node_modules/ws/lib/WebSocket.js:721:12 #5

qdhaiqiang opened this issue Feb 18, 2019 · 2 comments

Comments

@qdhaiqiang
Copy link

我的环境里发生了这种错误,请问下是什么原因呢?

image

@qdhaiqiang
Copy link
Author

events.js:167
throw er; // Unhandled 'error' event
^

Error: unexpected server response (200)
at ClientRequest.response (/usr/local/lib/node_modules/wsc/node_modules/ws/lib/WebSocket.js:719:15)
at Object.onceWrapper (events.js:275:13)
at ClientRequest.emit (events.js:182:13)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:534:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
at Socket.socketOnData (_http_client.js:421:20)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:280:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
Emitted 'error' event at:
at ClientRequest.response (/usr/local/lib/node_modules/wsc/node_modules/ws/lib/WebSocket.js:721:12)
at Object.onceWrapper (events.js:275:13)
[... lines matching original stack trace ...]
at Socket.Readable.push (_stream_readable.js:220:10)

@easytarget
Copy link

Bit late to the party, but in case anybody else washes up here.. The clue is in the error line:

Error: unexpected server response (200)

This means you have connected to a web server, not a websocket server..

eg: I have a device with a web server on port 80, and a websocket server on port 81:

$ wsc ws://10.0.0.112:80
wsc ws://10.0.0.112:80
events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: unexpected server response (200)
    at ClientRequest.response (/usr/local/lib/node_modules/wsc/node_modules/ws/lib/WebSocket.js:719:15)
    at Object.onceWrapper (events.js:421:26)
etc....
$ wsc ws://10.0.0.112:81
Connected to ws://10.0.0.112:81
< CURRENT_ID:0
< ACTIVE_ID:0
< PING:0
> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants