Thanks.
I'm using the websockets, then there is a session.
RunFunctionWithResult is performed by the server and it requires a result of the Client.
If I use just RunFunction, I will have to use:
a) Server "Runs a Funcion" (on client) like "Choose_a_Nickname"
b) on client the routine Choose_a_Nickname runs a routine in an activity to ask for a nick
c) this last routine runs a routine on server sending the nick
d) this last routine can be used by server to get the nick.
One request, four routines!
Using RunFunctionWithResult I can save a routine.
The only problem is that the timeout for RunFunctionWithResult is too short (about 8 seconds) and, in this case, the user does not have the time to respond.
I have worked around the problem in
this convoluted way.
(Server side)
Private Sub ToC_ReqNick(Msg As String) As String
Private mapResult As Map
Private ResultOK, TimeOut As Boolean, StartTime As Long
Private Nick As String
StartTime = DateTime.Now
Do Until ResultOK OR TimeOut
Try
Private fut As Future = ws.RunFunctionWithResult("FromS_ReqNick", Array As Object(Msg))
ws.Flush
mapResult = fut.Value
ResultOK = True
Catch
If DateTime.Now - StartTime >= 30000 Then
TimeOut = True
End If
End Try
Loop
If TimeOut Then
Return "#Timeout#"
End If
Nick = mapResult.Get("Nick")
Return Nick
End Sub