【发布时间】:2014-09-30 09:04:18
【问题描述】:
当我在我的电脑上运行我的代码并尝试在本地主机上用我的 index.html 连接套接字时没问题但是当我尝试在服务器上运行我的代码并尝试用 index.html 连接套接字时(它位于我的电脑上) 我明白了:
Router <tornadio2.session.ConnectionInfo object at 0x7f7bfc5fac10>
INFO:tornado.access:200 GET /socket.io/1/
DEBUG:root:Initializing websocket handler.
WARNING:tornado.access:403 GET /socket.io/1/websocket/c0532cea9001408c50a9c854f4bce5d8
然后它将协议切换到 xhr-polling 但我想使用 websocket。
INFO:tornado.access:200 GET /socket.io/1/xhr-polling/62f9b31662c984201685a830c764765e
DEBUG:root:Initializing xhr-polling transport.
DEBUG:root:>>> 1::/socket
DEBUG:root:<<< 1::/socket
DEBUG:root:<<< 3::/socket:connected!
我能做些什么来解决这个问题?
【问题讨论】:
-
你能提供你正在运行的代码吗
-
gist.github.com/SeyitOzanOzdil/0329ba2c9ebc9faa090e 这里是 Socket Connection 类的 on_open 和 on_close 部分
-
这是我的 html gist.github.com/SeyitOzanOzdil/d79881ede70ebb159740 我在我的电脑上打开它。
标签: python sockets socket.io tornado