I am trying to make a multiplayer game with Node.js as backend. I am deploying it on Heroku. As Heroku does not support TCP (at least on free and hobby tier), I have to use WebSockets. I found several libraries for WebSockets, such as:
These have either C or C++ dependencies or written in C++ itself. But I was not able to find any documentation on how to use C or C++ dependencies with love-android(there's also the hassle of compiling it for my desktop platform for developing and testing).
I also found this websocket client written in pure lua: https://github.com/flaribbit/love2d-lua-websocket. It works perfectly when my server is running on localhost but connects and then disconnects immediately (according to STATUS property provided by the library) when I try to connect to my deployed server on Heroku. I tried other WebSocket clients and a Node client I wrote myself and they work properly. So it is a problem with this library.
Please either point out the problem with flaribbit's websocket implementation or point to a tutorial about how to use C and C++ modules with love-android. Of course, I would prefer if I can work with flaribbit's websocket implementation as it rules out a whole lot of hassle of compilation.
WebSocket on love-android
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: WebSocket on love-android
I don't know much about Heroku or any of those libraries, but I'm pretty sure your local server doesn't use TLS, while Heroku most probably does, as any respectable web service should. WebSockets over TLS are strongly encrypted; the Lua library does not support that.
I don't think a pure Lua implementation of a TLS-capable sockets library exists. I've implemented WebSockets clients incl. TLS in Lua before with luvit. I don't know if there's a way to use luvit with love2d though, or whether Android is supported at all. Look it up and find out.
Or you could rent a VPS if you can spare like $5 USD a month. You can run whatever you want on those.
I don't think a pure Lua implementation of a TLS-capable sockets library exists. I've implemented WebSockets clients incl. TLS in Lua before with luvit. I don't know if there's a way to use luvit with love2d though, or whether Android is supported at all. Look it up and find out.
Or you could rent a VPS if you can spare like $5 USD a month. You can run whatever you want on those.
Re: WebSocket on love-android
Is there a way to use C and C++ libraries with love-android? Because I googled it and can't find a way to use luvit with Love2D. I will look into VPS but I don't really want to shell out money on a hobby project, more so, when I am not sure the project can return the investment.
- EngineerSmith
- Prole
- Posts: 38
- Joined: Thu Dec 02, 2021 11:38 am
- Contact:
Re: WebSocket on love-android
I've done it before to get ssl curl working, you had to put the shared library (*.so) in a certain location (with the other shared libraries so just look around in it within the android folders) and then you can just load it with ffi
Re: WebSocket on love-android
Can you please explain in detail how to compile to *.so file and where exactly to place them? Thank you so much for you help.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 2 guests