我有以下联系:
GET /.ws?ns=XXXXX&v=5&ls=XXXXXXXX HTTP/1.1
Host: firebaseio.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: XXXXXXXXXX
然后显示一条101 Switching Protocols
消息:
TTP/1.1 101 Switching Protocols
Server: nginx
Date: Mon, 30 Jul 2018 11:58:49 GMT
Connection: upgrade
Upgrade: websocket
Sec-WebSocket-Accept: XXXXXXXXX
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload
我想听听websocket,但所有示例都需要一个ws://
连接,这里的连接是通过URL建立的。
答案 0 :(得分:0)
查看以下内容:https://github.com/ilkerkesen/tornado-websocket-client-example/blob/master/client.py
只需替换url方案:
http:// -> ws://
https:// -> wss://