JVE*_*999 12 javascript node.js socket.io http-status-code-400
我正在尝试运行socket.io,我得到了一堆这些:
http://domain.com:8080/socket.io/?EIO=2&transport=polling&t=1401421022966-0 400 (Bad Request)
Run Code Online (Sandbox Code Playgroud)
这是我得到的回应:
{"code":0,"message":"Transport unknown"}
Run Code Online (Sandbox Code Playgroud)
我找不到任何理由.我在某个地方看到它可能会误解客户端,但这就是我能得到的.
小智 15
我有同样的问题,从0.9.x升级后,我的服务器配置被设置为['websocket', 'jsonp-polling']在0.9中有效,但现在是客户端和服务器的默认配置['polling', 'websocket'].删除我的服务器配置让我开始运行.
配置现在记录在engine.io(https://github.com/automattic/engine.io)中,1.0中引入了新的传输层 - 特别是这一行:
transports ( String): transports to allow connections to (['polling', 'websocket'])
从0.9.x升级到1.xx之后我遇到了同样的问题缩短了长篇故事,我将传输设置为['websocket','polling'],然后错误......
当您将服务器配置为使用specefic transpors时,您应该在客户端将相同的配置设置为...
服务器
var io = require('socket.io')(server, {'transports': ['websocket', 'polling']});
Run Code Online (Sandbox Code Playgroud)
客户
var io = io( serverUri, {'transports': ['websocket', 'polling']});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30215 次 |
| 最近记录: |