LucaMs Expert Licensed User Longtime User Aug 6, 2014 #1 My first steps with WebSockets. I have tried to start developing my "game architecture" using WebSocket Client Library as basic. First step, first snag. My "draft" works using a PC as server and my smartphone as client. It does not work using an emulator. The example WebSocket Client Library works in both cases. (Note: My draft works using my smartphone, but I don't like it; it remember me the "spaghetti programming". So, I should ask how RunFunctionWithResult works, thinking that I could use it, but I'm hearing: "Please start a new thread for this question." ) Thank you in advance Attachments GameServer.zip GameServer.zip 1.4 KB · Views: 461 GameClient.zip GameClient.zip 13.1 KB · Views: 464
My first steps with WebSockets. I have tried to start developing my "game architecture" using WebSocket Client Library as basic. First step, first snag. My "draft" works using a PC as server and my smartphone as client. It does not work using an emulator. The example WebSocket Client Library works in both cases. (Note: My draft works using my smartphone, but I don't like it; it remember me the "spaghetti programming". So, I should ask how RunFunctionWithResult works, thinking that I could use it, but I'm hearing: "Please start a new thread for this question." ) Thank you in advance
Erel B4X founder Staff member Licensed User Longtime User Aug 6, 2014 #2 I recommend you to avoid using the emulator at all. Use a real device instead. ws.RunFunction runs a JavaScript function (usually a void function). ws.RunFunctionWithResult runs a JavaScript function and returns the function result as a Future object. Upvote 0
I recommend you to avoid using the emulator at all. Use a real device instead. ws.RunFunction runs a JavaScript function (usually a void function). ws.RunFunctionWithResult runs a JavaScript function and returns the function result as a Future object.
LucaMs Expert Licensed User Longtime User Aug 6, 2014 #3 Erel said: I recommend you to avoid using the emulator at all. Use a real device instead. Click to expand... Yes, I know, and I agree, but when you have time (ie never ) could you compare the two projects? They are almost identical and, tested on the same emulator, your project works well, mine not! Also, I would need to run tests with 6 devices! Erel said: ws.RunFunction runs a JavaScript function (usually a void function). ws.RunFunctionWithResult runs a JavaScript function and returns the function result as a Future object. Click to expand... Yes, I had understood that difference, but the code "waits" for the result? In addition, the Future object is a mystery uhm what can I say, now? Damn memory... Oh, yes... THANK YOU, EREL Upvote 0
Erel said: I recommend you to avoid using the emulator at all. Use a real device instead. Click to expand... Yes, I know, and I agree, but when you have time (ie never ) could you compare the two projects? They are almost identical and, tested on the same emulator, your project works well, mine not! Also, I would need to run tests with 6 devices! Erel said: ws.RunFunction runs a JavaScript function (usually a void function). ws.RunFunctionWithResult runs a JavaScript function and returns the function result as a Future object. Click to expand... Yes, I had understood that difference, but the code "waits" for the result? In addition, the Future object is a mystery uhm what can I say, now? Damn memory... Oh, yes... THANK YOU, EREL
Erel B4X founder Staff member Licensed User Longtime User Aug 6, 2014 #4 See the network latency section here: http://www.b4x.com/android/forum/threads/webapp-hello-world-web-app.39808/#content Only when you call Future.Value will the thread wait for the value to be available (if it is not already available). Upvote 0
See the network latency section here: http://www.b4x.com/android/forum/threads/webapp-hello-world-web-app.39808/#content Only when you call Future.Value will the thread wait for the value to be available (if it is not already available).
LucaMs Expert Licensed User Longtime User Aug 6, 2014 #5 Erel said: See the network latency section here: http://www.b4x.com/android/forum/threads/webapp-hello-world-web-app.39808/#content Only when you call Future.Value will the thread wait for the value to be available (if it is not already available). Click to expand... Many thanks Upvote 0
Erel said: See the network latency section here: http://www.b4x.com/android/forum/threads/webapp-hello-world-web-app.39808/#content Only when you call Future.Value will the thread wait for the value to be available (if it is not already available). Click to expand... Many thanks