QtSocketIo icon indicating copy to clipboard operation
QtSocketIo copied to clipboard

socket.io 1.x support

Open tace opened this issue 9 years ago • 3 comments

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

tace avatar Apr 03 '15 19:04 tace

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 [email protected] 写道:

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.

bokecc-cn avatar Apr 04 '15 00:04 bokecc-cn

@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 avatar Jun 26 '15 10:06 toby20130333

我断定是自己拷贝了一份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不需要你自己拷贝进去,直接就可以引用

toby20130333 avatar Jun 15 '16 10:06 toby20130333