I was wondering how hard it would be to have some basic socket support. Lua doesn't have it on it's own, but rather needs a C library (
LuaSocket). Is that easy to compile into the rest of the Lua runner? Or is this something that really should go into a Plugin, when those are available?
For many things, URLLoader is probably good enough, but it's kind of hard to push things from a server using HTTP (though there are ways). Speaking of which, how does URLLoader react if you don't reply for a while from the server, does it time out or does it stay connected "forever"? Because if it just waits, then that's one way of doing it.
Comments
LuaSocket is by default a blocking socket library and it should be used with one of the threading libraries or with Copas to avoid blocking of game loop. Therefore, we need to design a socket library which will be also compatible with our event system.
URLLoader is non-blocking and asynchronous. The functions URLLoader.new and URLLoader:load immediately returns and the current state is watched through Event.COMPLETE, Event.PROGRESS and Event.ERROR events. For example, if server doesn't reply for a long time and timeout occurs, Event.ERROR is dispatched and the connection is closed automatically. Meanwhile game your loop continues to execute
Likes: gorkem
With it's select() and settimeout() it is completely possible to write non-blocking networking applications with Lua Sockets.
Corona does it, and I've written apps that have built-in servers in them (using copas).
Not being able to do so from Gideros is likely to be a showstopper for me.
-d
Likes: acesquared
Likes: gorkem
@acesquared, uhm.. LuaSec depends on OpenSSL. I don't have any experience building OpenSSL on iOS and Android. Anyway, I'm adding it to the roadmap but I'll take time to support it. http://bugs.giderosmobile.com/issues/94
Likes: techdojo, phongtt, OZApps
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
(I'm not super-anxious for it; knowing it will be included the next version is enough to allow me to proceed with using Gideros...)
Thanks!
-d
@OZApps I couldn't post the plugin here yet. Maybe a couple of days later.