LucaMs Expert Licensed User Longtime User Oct 8, 2020 #1 It will be difficult to write this question, especially in English, forgive me. In an app I'm using a B4XPage that acts as connection (websocket) between client and server (in practice the page is as if it represented the websocket itself but also having a minimum of GUI to show the "connection animation" and a couple of dialogs in in case of no Internet connection or server unreachable. All the project has a very bad design - and this is just the starting point - that is also driving me crazy; but no one helps me, I feel so alone ?) ? I must try to synthesize as much as possible. PageX uses that "WS page" to connect. In "WS page" I have: B4X: '... If etype = "runFunction" Then CallSub2(mCallback, mEventName & "_" & event, mapParams) End If '... (you know this code, Erel). In PageX I set that "WS page"'s mCallback to Me (WS page has a property...!) Well, if I write a sub in PageX "called" by the server, like: B4X: Sub MyRoutine(params As map) '... it is "reached" by the CallSub2 above; instead if I write, still in PageX: B4X: Wait For MyRoutine(params As map) it is not. If I explained too badly... I will try to develop a small project, without websocket, and I will attach it. EDIT: what a Log(mCallback) shows! Just to know/check what the current callback object is!. Last edited: Oct 8, 2020
It will be difficult to write this question, especially in English, forgive me. In an app I'm using a B4XPage that acts as connection (websocket) between client and server (in practice the page is as if it represented the websocket itself but also having a minimum of GUI to show the "connection animation" and a couple of dialogs in in case of no Internet connection or server unreachable. All the project has a very bad design - and this is just the starting point - that is also driving me crazy; but no one helps me, I feel so alone ?) ? I must try to synthesize as much as possible. PageX uses that "WS page" to connect. In "WS page" I have: B4X: '... If etype = "runFunction" Then CallSub2(mCallback, mEventName & "_" & event, mapParams) End If '... (you know this code, Erel). In PageX I set that "WS page"'s mCallback to Me (WS page has a property...!) Well, if I write a sub in PageX "called" by the server, like: B4X: Sub MyRoutine(params As map) '... it is "reached" by the CallSub2 above; instead if I write, still in PageX: B4X: Wait For MyRoutine(params As map) it is not. If I explained too badly... I will try to develop a small project, without websocket, and I will attach it. EDIT: what a Log(mCallback) shows! Just to know/check what the current callback object is!.
Erel B4X founder Staff member Licensed User Longtime User Oct 8, 2020 #2 LucaMs said: Wait For MyRoutine(params As map) Click to expand... This line will not call any sub. It will wait for an event named "MyRoutine". Upvote 0
LucaMs said: Wait For MyRoutine(params As map) Click to expand... This line will not call any sub. It will wait for an event named "MyRoutine".
LucaMs Expert Licensed User Longtime User Oct 8, 2020 #3 Erel said: This line will not call any sub. It will wait for an event named "MyRoutine". Click to expand... I know that . As I feared, I explained wrong. I'm writing an example but... 1 - got a strange behavior 2 - the problem posted in #1 does not happen; maybe because this project does not uses a websocket, it is a "simulation". (1) mDone??? (see the code) EDIT: (1) - the "mDone" now seems to work ?. Anyway the problem is explained in post #1, but in this project not even this problem exists Attachments Project.zip Project.zip 14.6 KB · Views: 509 Upvote 0
Erel said: This line will not call any sub. It will wait for an event named "MyRoutine". Click to expand... I know that . As I feared, I explained wrong. I'm writing an example but... 1 - got a strange behavior 2 - the problem posted in #1 does not happen; maybe because this project does not uses a websocket, it is a "simulation". (1) mDone??? (see the code) EDIT: (1) - the "mDone" now seems to work ?. Anyway the problem is explained in post #1, but in this project not even this problem exists
LucaMs Expert Licensed User Longtime User Oct 8, 2020 #4 LucaMs said: 2 - the problem posted in #1 does not happen; maybe because this project does not uses a websocket, it is a "simulation". Click to expand... LucaMs said: Anyway the problem is explained in post #1, but in this project not even this problem exists Click to expand... Erel, please remove all this thread; the real project today works, maybe yesterday it didn't like the temperature in my house ? ??? Upvote 0
LucaMs said: 2 - the problem posted in #1 does not happen; maybe because this project does not uses a websocket, it is a "simulation". Click to expand... LucaMs said: Anyway the problem is explained in post #1, but in this project not even this problem exists Click to expand... Erel, please remove all this thread; the real project today works, maybe yesterday it didn't like the temperature in my house ? ???
TILogistic Expert Licensed User Longtime User Oct 8, 2020 #5 LucaMs said: Erel, please remove all this thread; the real project today works, maybe yesterday it didn't like the temperature in my house ? ??? Click to expand... you always make me laugh with your final comments. You add a touch of humor to the forum ?????? Upvote 0
LucaMs said: Erel, please remove all this thread; the real project today works, maybe yesterday it didn't like the temperature in my house ? ??? Click to expand... you always make me laugh with your final comments. You add a touch of humor to the forum ??????
TILogistic Expert Licensed User Longtime User Oct 8, 2020 #6 humor = the quality of being amusing or comic, especially as expressed in literature or speech. Upvote 0
LucaMs Expert Licensed User Longtime User Oct 8, 2020 #7 Modified the title. Always do it when the problem is solved; even when it is... dissolved. Upvote 0