可以在与HTTP请求相同的套接字上发送WebSocket握手吗?

时间:2012-08-06 00:03:48

标签: websocket

基本上,标准是否允许这种互动? (Python伪代码:)

import socket
s = socket.create_connection((host, 80))
s.send("GET /index.html HTTP/1.1\nHost:example.com\nConnection:keep-alive\n\n")
s.recv() // Should be a 200
s.send("GET /websocket HTTP/1.1\nHost:example.com\nUpgrade: websocket\nConnection: Upgrade\n\n")
s.recv() // Should be 101

0 个答案:

没有答案