Networking with cocos2d-x-3 for Multiplayer

Networking with cocos2d-x-3 for Multiplayer



I need a game-server that lets my turn based game also features:

  • leaving the game
  • leaving the lobby
  • sending a chat message

and other stuff that requires the server to send data to the client, which seems only possible to some degree with long polling on HTTP.

I wanted to know if cocos2d-x-3 offers anything to communicate via WebSocket-server on Windows, MacOS, iOS, and Android and if there are any guides for that?
If there is anything that cocos2d-x-3 supports that I could use for this kind of communication, that would be great.

Thanks for your time!


RakNet? Or just build your own using simple web requests, Json, etc


Oh, I was just wondering if cocos2d-x-3 somehow offers something like WebSocket-support on its own since it does for HTTP, but if that’s not the case, I will just take a library for that.


We support web sockets too


For client side you can use inbuilt class SocketIO to communicate with your server, we were using from more then 2 years. BUT recently we were faced few serious issue with it, so i will suggest to use official


Oh, what is that? Also thanks for the recommendation!


Well you will find few threads which i created here for that.
One major issue was that it might not work with all 3g/4g connections, problem is with Websocket library which cocos socketio is using.
Official socketio-cpp library is using WebsocketPP and it works fine.