Over the weekend I set up all the networking for a game I was making. I was basing it off this tutorial: GamesFromScratch.com Basic LibGDX Networking. It said that it only supported TCP but I was okay with that since I could figure something out and there was a bunch of material online on how to make real time games without UDP. After I finished, I tested it on desktop, android and then on HTML5/GWT. Desktop and android worked but GWT didn't. I did some research and found that Gdx.net does not support GWT, the article didn't warn me :/ Basically now I am trying to find an alternative solution that will work with ALL libgdx platforms.
I looked into Websockets with Socket IO. Here are the Java libraries I found for the: Client and Server. The server library says it works well with the client one which is reassuring. It seems like a good solution but I have a few questions:
- Would the client library work on all platforms? It seems that it would work on android and desktop since they don't have to convert to another language but what about GWT and iOS? And not only just work, but also be able to connect to the server using the server library.
- Is there anything I need to watch out for when using websockets?
Thanks.
EDIT: I did a little bit more research and I found Jetty. I looked around and it seems to be GWT compatible, I just need to know if it is also iOS compatible. And could I use Jetty as my server api also?
I did it. I did a lot of research in the past few days and I finally found this post on stackoverflow.com that told me about 2 great libraries including one I could use with the client that supports GWT.
It works great, the only thing is that I will have to use 2 WebSocket libraries for the client, one on html and another for all the other platforms but that's okay, at least it works.
The libraries are: Client and Server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With