Where can I find some examples on using websocket in Corona?
I am looking for some samples too…or XMPP
Look in the Community Code in the Networking category. There should be a couple of things there like AutoLan that might get you started.
I am looking for some samples too…or XMPP
Look in the Community Code in the Networking category. There should be a couple of things there like AutoLan that might get you started.
i have published a library module to support WebSockets in Corona.
if you’re interested: http://code.coronalabs.com/code/dmcwebsockets
cheers,
dmc
i have published a library module to support WebSockets in Corona.
if you’re interested: http://code.coronalabs.com/code/dmcwebsockets
cheers,
dmc
Hi dmc,
I’m using the websocket client, and while it all works well on the simulator, once I have it on an Android device (nexus 4) there is no connection, and I’m getting this in the console. Any suggestions?
I’ve set up my project how you’ve outlined in the readme.md.
output:
07-10 18:40:15.617: I/ActivityManager(584): Displayed com.develephant.cbyerley.dmc\_websockets/com.ansca.corona.CoronaActivity: +134ms 07-10 18:40:15.647: V/Corona(24429): \> Class.forName: network.LuaLoader 07-10 18:40:15.647: V/Corona(24429): \< Class.forName: network.LuaLoader 07-10 18:40:15.647: V/Corona(24429): Loading via reflection: network.LuaLoader 07-10 18:40:15.647: I/Corona(24429): Platform: Nexus 4 / ARM Neon / 4.4.4 / Adreno (TM) 320 / OpenGL ES 3.0 V@53.0 AU@ (CL@) 07-10 18:40:15.687: D/dalvikvm(24429): GC\_CONCURRENT freed 341K, 4% free 9565K/9944K, paused 2ms+1ms, total 16ms 07-10 18:40:15.687: W/linker(24429): liblicensing.so has text relocations. This is wasting memory and is a security risk. Please fix. 07-10 18:40:15.687: V/Corona(24429): \> Class.forName: CoronaProvider.licensing.google.LuaLoader 07-10 18:40:15.687: V/Corona(24429): \< Class.forName: CoronaProvider.licensing.google.LuaLoader 07-10 18:40:15.687: V/Corona(24429): Loading via reflection: CoronaProvider.licensing.google.LuaLoader 07-10 18:40:15.687: I/Corona(24429): ############################################## 07-10 18:40:15.697: V/Corona(24429): \> Class.forName: lua\_objects.LuaLoader 07-10 18:40:15.697: V/Corona(24429): WARNING: Could not load 'LuaLoader' 07-10 18:40:15.697: W/System.err(24429): java.lang.ClassNotFoundException: lua\_objects.LuaLoader 07-10 18:40:15.697: W/System.err(24429): at java.lang.Class.classForName(Native Method) 07-10 18:40:15.697: W/System.err(24429): at java.lang.Class.forName(Class.java:251) 07-10 18:40:15.697: W/System.err(24429): at java.lang.Class.forName(Class.java:216) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:337) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:316) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:357) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1611) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) 07-10 18:40:15.697: W/System.err(24429): Caused by: java.lang.NoClassDefFoundError: lua\_objects/LuaLoader 07-10 18:40:15.697: W/System.err(24429): ... 9 more 07-10 18:40:15.697: W/System.err(24429): Caused by: java.lang.ClassNotFoundException: Didn't find class "lua\_objects.LuaLoader" on path: DexPathList[[zip file "/data/app/com.develephant.cbyerley.dmc\_websockets-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.develephant.cbyerley.dmc\_websockets-1, /vendor/lib, /system/lib]] 07-10 18:40:15.697: W/System.err(24429): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 07-10 18:40:15.697: W/System.err(24429): at java.lang.ClassLoader.loadClass(ClassLoader.java:497) 07-10 18:40:15.697: W/System.err(24429): at java.lang.ClassLoader.loadClass(ClassLoader.java:457) 07-10 18:40:15.697: W/System.err(24429): ... 9 more 07-10 18:40:15.697: I/Corona(24429): Runtime error 07-10 18:40:15.697: I/Corona(24429): module 'lua\_objects' not found:resource (lua\_objects.lu) does not exist in archive 07-10 18:40:15.697: I/Corona(24429): no field package.preload['lua\_objects'] 07-10 18:40:15.697: I/Corona(24429): no file '(null)/lua\_objects.lua' 07-10 18:40:15.697: I/Corona(24429): no file '(null)/lua\_objects.lua' 07-10 18:40:15.697: I/Corona(24429): no file '/data/app-lib/com.develephant.cbyerley.dmc\_websockets-1/liblua\_objects.so' 07-10 18:40:15.697: I/Corona(24429): no file './lua\_objects.so' 07-10 18:40:15.697: I/Corona(24429): no file '(null)/lua\_objects.so' 07-10 18:40:15.697: I/Corona(24429): stack traceback: 07-10 18:40:15.697: I/Corona(24429): [C]: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in main chunk 07-10 18:40:15.697: I/Corona(24429): [C]: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in main chunk 07-10 18:40:16.058: D/dalvikvm(24429): GC\_CONCURRENT freed 577K, 7% free 9493K/10108K, paused 1ms+2ms, total 24ms
Cheers.
hmmm, appears the file lookup on Android works a little differently than it might otherwise. (interesting thing to note is those (null)'s in the search paths.)
my initial guess is that this is occurring because Android apps exist in a file and not laid out on a real filesystem and that conflicts with something in my code. i’ll check into it - i have an idea about what i need to update if that is indeed the case.
if necessary, will it be possible to get a copy of your project ?
cheers,
dmc
Hi dmc,
I sent you some more details and files via direct message.
Thanks for the great modules!
Cheers.
hey develephant,
i spent some time this evening looking into this and uncovered the issue. i won’t go into the details, but i do have a solution in mind and i’ll start working on it tomorrow.
i’ll check for your message, and thanks for the kudos ! =)
cheers,
dmc
Wondering about the status of the dmc_websockets library. I may have a project that will that need it for cross platform IOS and Android development.
Thanks,
Scot
I’ve been using it to test the upcoming WebSocket module for Coronium and it seems to be working great.
http://docs.davidmccuskey.com/display/docs/dmc_websockets.lua
Cheers.
Scot,
there’s been a lot of work done on the lib in the past couple of weeks to make it solid, esp verifying functionality against the Autobahn Test Suite. there are others who have been testing/integrating into apps as well.
https://github.com/dmccuskey/DMC-Corona-Library/wiki/dmc_websockets-Updates
cheers,
dmc
Great to hear. Thanks D…
Scot
Noobhub has nothing to do with websockets (RFC 6455).
@dmccusky
The PI on our project has indeed chosen CSDK, so I will be using websockets.
Thanks for your help on this. Looking forward to digging in.
Thanks,
–Scot
Hi dmc,
I’m using the websocket client, and while it all works well on the simulator, once I have it on an Android device (nexus 4) there is no connection, and I’m getting this in the console. Any suggestions?
I’ve set up my project how you’ve outlined in the readme.md.
output:
07-10 18:40:15.617: I/ActivityManager(584): Displayed com.develephant.cbyerley.dmc\_websockets/com.ansca.corona.CoronaActivity: +134ms 07-10 18:40:15.647: V/Corona(24429): \> Class.forName: network.LuaLoader 07-10 18:40:15.647: V/Corona(24429): \< Class.forName: network.LuaLoader 07-10 18:40:15.647: V/Corona(24429): Loading via reflection: network.LuaLoader 07-10 18:40:15.647: I/Corona(24429): Platform: Nexus 4 / ARM Neon / 4.4.4 / Adreno (TM) 320 / OpenGL ES 3.0 V@53.0 AU@ (CL@) 07-10 18:40:15.687: D/dalvikvm(24429): GC\_CONCURRENT freed 341K, 4% free 9565K/9944K, paused 2ms+1ms, total 16ms 07-10 18:40:15.687: W/linker(24429): liblicensing.so has text relocations. This is wasting memory and is a security risk. Please fix. 07-10 18:40:15.687: V/Corona(24429): \> Class.forName: CoronaProvider.licensing.google.LuaLoader 07-10 18:40:15.687: V/Corona(24429): \< Class.forName: CoronaProvider.licensing.google.LuaLoader 07-10 18:40:15.687: V/Corona(24429): Loading via reflection: CoronaProvider.licensing.google.LuaLoader 07-10 18:40:15.687: I/Corona(24429): ############################################## 07-10 18:40:15.697: V/Corona(24429): \> Class.forName: lua\_objects.LuaLoader 07-10 18:40:15.697: V/Corona(24429): WARNING: Could not load 'LuaLoader' 07-10 18:40:15.697: W/System.err(24429): java.lang.ClassNotFoundException: lua\_objects.LuaLoader 07-10 18:40:15.697: W/System.err(24429): at java.lang.Class.classForName(Native Method) 07-10 18:40:15.697: W/System.err(24429): at java.lang.Class.forName(Class.java:251) 07-10 18:40:15.697: W/System.err(24429): at java.lang.Class.forName(Class.java:216) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.NativeToJavaBridge.callLoadClass(NativeToJavaBridge.java:337) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:316) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:357) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1611) 07-10 18:40:15.697: W/System.err(24429): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377) 07-10 18:40:15.697: W/System.err(24429): Caused by: java.lang.NoClassDefFoundError: lua\_objects/LuaLoader 07-10 18:40:15.697: W/System.err(24429): ... 9 more 07-10 18:40:15.697: W/System.err(24429): Caused by: java.lang.ClassNotFoundException: Didn't find class "lua\_objects.LuaLoader" on path: DexPathList[[zip file "/data/app/com.develephant.cbyerley.dmc\_websockets-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.develephant.cbyerley.dmc\_websockets-1, /vendor/lib, /system/lib]] 07-10 18:40:15.697: W/System.err(24429): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 07-10 18:40:15.697: W/System.err(24429): at java.lang.ClassLoader.loadClass(ClassLoader.java:497) 07-10 18:40:15.697: W/System.err(24429): at java.lang.ClassLoader.loadClass(ClassLoader.java:457) 07-10 18:40:15.697: W/System.err(24429): ... 9 more 07-10 18:40:15.697: I/Corona(24429): Runtime error 07-10 18:40:15.697: I/Corona(24429): module 'lua\_objects' not found:resource (lua\_objects.lu) does not exist in archive 07-10 18:40:15.697: I/Corona(24429): no field package.preload['lua\_objects'] 07-10 18:40:15.697: I/Corona(24429): no file '(null)/lua\_objects.lua' 07-10 18:40:15.697: I/Corona(24429): no file '(null)/lua\_objects.lua' 07-10 18:40:15.697: I/Corona(24429): no file '/data/app-lib/com.develephant.cbyerley.dmc\_websockets-1/liblua\_objects.so' 07-10 18:40:15.697: I/Corona(24429): no file './lua\_objects.so' 07-10 18:40:15.697: I/Corona(24429): no file '(null)/lua\_objects.so' 07-10 18:40:15.697: I/Corona(24429): stack traceback: 07-10 18:40:15.697: I/Corona(24429): [C]: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in main chunk 07-10 18:40:15.697: I/Corona(24429): [C]: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in function 'require' 07-10 18:40:15.697: I/Corona(24429): ?: in main chunk 07-10 18:40:16.058: D/dalvikvm(24429): GC\_CONCURRENT freed 577K, 7% free 9493K/10108K, paused 1ms+2ms, total 24ms
Cheers.
hmmm, appears the file lookup on Android works a little differently than it might otherwise. (interesting thing to note is those (null)'s in the search paths.)
my initial guess is that this is occurring because Android apps exist in a file and not laid out on a real filesystem and that conflicts with something in my code. i’ll check into it - i have an idea about what i need to update if that is indeed the case.
if necessary, will it be possible to get a copy of your project ?
cheers,
dmc
Hi dmc,
I sent you some more details and files via direct message.
Thanks for the great modules!
Cheers.