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:
'...
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:
Sub MyRoutine(params As map)
'...
it is "reached" by the CallSub2 above; instead if I write, still in PageX:
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!.