Android Question [Dis_solved] Strange (mad?) question about classes' callbacks

LucaMs

Expert
Licensed User
Longtime User
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:

LucaMs

Expert
Licensed User
Longtime User
This line will not call any sub. It will wait for an event named "MyRoutine".
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 :mad:
 

Attachments

  • Project.zip
    14.6 KB · Views: 88
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
2 - the problem posted in #1 does not happen; maybe because this project does not uses a websocket, it is a "simulation".
Anyway the problem is explained in post #1, but in this project not even this problem exists
Erel, please remove all this thread; the real project today works, maybe yesterday it didn't like the temperature in my house ๐Ÿ˜„:mad: ๐Ÿ˜„๐Ÿ˜ณ๐Ÿค”
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Modified the title. Always do it when the problem is solved; even when it is... dissolved.
 
Upvote 0
Top