KurtPattyn / QtSocketIo

socket.io implementation in Qt
GNU Lesser General Public License v2.1
51 stars 16 forks source link

socket.io 1.x support #5

Open tace opened 9 years ago

tace commented 9 years ago

Hi,

Does this support socket.io 1.0 version or above? http://socket.io/ I want to implement mobile client with Qt and QML for SailfishOs. Sailfish using Qt5.2 currently and I was checking your QtSocketIo if I could use it. Server is implemented with node.js and I cannot much affect that implementation.

Br -Samuli

bokecc-cn commented 9 years ago

No! I have report the bug about 2 months ago, I used webview embed webpage to application to resolve the problem.

发自我的 iPhone

在 2015年4月4日,03:26,Samuli Silvius notifications@github.com 写道:

Hi,

Does this support socket.io 1.0 version or above? http://socket.io/ I want to implement mobile client with Qt and QML for SailfishOs. Sailfish using Qt5.2 currently and I was checking your QtSocketIo if I could use it. Server is implemented with node.js and I cannot much affect that implementation.

Br -Samuli

— Reply to this email directly or view it on GitHub.

toby20130333 commented 9 years ago

@tace I get the same problem of qtsocketio,my server socketio 1.3.x version,I get a return code is status 400 reply "{"code":0,"message":"Transport unknown"}",Anybody can resovle this ?

toby20130333 commented 8 years ago

我断定是自己拷贝了一份socket.io 0.9.x版本的浏览器端js,然后在浏览器发起的ws请求 而服务端socket.io版本是1.x, 这两个版本根本不通用!

0.9.x版本会先尝试建立websocket连接,地址格式是/socket.io/1/?t=xxx,如果服务器响应超时,或者拒绝,会fallback到polling,服务端响应的数据格式是sid:interval_time:timeout_time:...这样的,不会产生json格式的响应

1.x版本会优先建立polling请求,地址格式是/socket.io/?transport=polling&t=xxx,然后upgrade到websocket,服务端返回json格式的配置文件,如果出现错误,返回的json格式就是{"code":0,"message":"xxx"}

所以你使用了0.9.x版本的客户端socket.io向1.x版本的服务端socket.io发起了请求,解决办法是使用socket.io内置的js,地址是/socket.io/socket.io.js,这个js不需要你自己拷贝进去,直接就可以引用