Page 1 of 1

[SOLVED] native cocos2d-js connection faild

Posted: 02 Jun 2015, 10:00
by anasmatic
Hi,

I'm developing a multiplayer game with cocos2d-js, I'll port it to web , Android and IOS.

I'm using the JS APIs, and it works great on web.
but when I deploy to native it is not working.
in details :
when I use the HTML5 socket connection port , I got this error:
12:35:55 PM [INFO] SmartFox instance ready!
12:35:55 PM [WebSocket::init] _host: 127.0.0.1, _port: 8787, _path: /websocket
12:35:55 PM JS: Connection failed: Is the server running at all?

and on SFS2x console
11:35:55,095 INFO [New I/O worker #1] sessions.DefaultSessionManager - Session created: { Id: 3, Type: WEBSOCKET, Logged: No, IP: 127.0.0.1 } on Server port: 8787 <---> 4028
11:35:55,138 WARN [New I/O worker #1] netty.WebSocketServerHandler - org.jboss.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Requested subprotocol(s) not supported: default-protocol
11:35:55,148 INFO [New I/O worker #1] sessions.DefaultSessionManager - Session removed: { Id: 3, Type: WEBSOCKET, Logged: No, IP: 127.0.0.1:4028 }


and when I use the default Socket connection Port 9933 I got this error on client:
11:55:19 AM [INFO] SmartFox instance ready!
11:55:19 AM [WebSocket::init] _host: 127.0.0.1, _port: 9933, _path: /websocket
11:55:25 AM JS:Connection failed: Is the server running at all?

and on SFS2x console
10:55:19,806 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:2656 } on Server port: 9933 <---> 2656
10:55:25,033 INFO [SocketReader] sessions.DefaultSessionManager - Session removed: { Id: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:2656 }


I see a "protocol not supported" Error when I'm using the HTML5 port,
but when I'm using the socket port 9933, I got no error, just a session created and removed in 5 seconds..
I use custom login and this behavior is similar to when you connect and don't handle the login phase..
and I'm sure that I'm handling the login phase

please advice.
thanks

Re: native cocos2d-js connection faild

Posted: 03 Jun 2015, 06:13
by Lapo
We have addressed this issue in SmartFoxServer 2X 2.10.0

You can upgrade here:
http://www.smartfoxserver.com/download/sfs2x#p=updates

Cheers

Re: native cocos2d-js connection faild

Posted: 03 Jun 2015, 07:48
by anasmatic
what a relief,
thank you

now using html5 socket port is possible in my case

thanks again