Defold & socket.io

Hello,

I need to port a multi player game to Defold from Unity, the game depends heavily on socket.io. I see that there is no support for socket.io in Defold and I am not sure if this could be a reason to use a different tool. I do not want to change socket.io to anything else since I don’t want to change the back end.

Thanks in advance!

This was also asked on Slack. Here’s my answer:

While there is currently no native socket.io support I see that there is both a Javascript client library available and a C++ library.

Defold can interact with the embedding HTML and any javascript on the page via html5.run() (basically calling eval). This is probably not good enough in your case, at least not for realtime games. The C++ library can most likely be wrapped into a Defold native extension so that you get a nice Lua interface.

But there is also the defold-websocket extension that uses lua-socket and lua-websocket to set up the (web)socket communication with your backend.

The defold-websocket extension is basically raw websockets so you’d need to implement any socket.io functionality on top of it.

1 Like

Yeah, I was expecting this reply :slight_smile:

Thanks for taking the time to reply on this.

2 Likes