B4J Question Wait for something to process before continuing

Discussion in 'B4J Questions' started by aaronk, Jul 19, 2015.

  1. aaronk

    aaronk Well-Known Member Licensed User


    I am using a Class Module within my B4J app and from the WebSocket module I have Initialize the class.

    In this class module I am using a SOAP message request which will send the message off and in the JobDone sub I am getting the reply. Which is all working fine.

    The part I need help with is..

    From my WebSocket Module I want to know if the value that is returned from the SOAP message equals something before the code continues in a sub.

    For Example:
    I am sending a SOAP message to request if a user exists on the server.
    The reply I should get back either yes or no (which I have working.)

    From my code I want to check what that value is before continuing in that sub.

    B4A/B4i (or even my webpage with the websocket) sends a WebSocket request to my B4J app and asks "does user abc exist on the 3rd Party server"
    The B4J needs to send a SOAP message to a 3rd Party server and check if the user exists on the server.

    (I need to check if the user exists from the B4J app and not the B4A/B4i app.)

    IF the reply from SOAP Message = "yes" Then
    ' send message to the B4A/B4i app and send "yes"
    End If
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. Send the request.
    2. Call StartMessageLoop.
    3. In JobDone call StopMessageLoop.
  3. aaronk

    aaronk Well-Known Member Licensed User

    Shouldn't it be the other way around?

    Call StartMessageLoop in Main Module:
    Sub AppStart (Args() As String)
    End Sub
    Webpages on my server is running and loading etc.

    User then requests if the user is valid..

    1. Send the SOAP request - call StopMessageLoop
    (by the way, at this point what happens if another user tries to view files on my server, does it mean nothing will load until StartMessageLoop is called?)

    2. In JobDone call StartMessageLoop.

    Do I have the above correct ?
  4. Erel

    Erel Administrator Staff Member Licensed User


    You should send the request and then call StartMessageLoop. The code after the StartMessageLoop call will only run after StopMessageLoop has been called.

    No. It only blocks the current thread. Each request is handled by a different thread.
    DonManfred likes this.
  5. aaronk

    aaronk Well-Known Member Licensed User

    Thanks heaps for your reply.. all makes sense now :)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice