Public Sub OnCLient_Req(WS As WebSocket, ClientFunctionName As String, TimeOutMs As Long, Msg As String) As Map
Private mapResult As Map : mapResult.Initialize
Private ResultOK, TimeOut As Boolean, StartTime As Long
StartTime = DateTime.Now
Do Until ResultOK OR TimeOut
Try
Private fut As Future = WS.RunFunctionWithResult(ClientFunctionName, Array As Object(Msg))
WS.Flush
mapResult = fut.Value
ResultOK = True
Catch
If DateTime.Now - StartTime >= TimeOutMs Then
TimeOut = True
End If
End Try
Loop
If TimeOut Then
mapResult.Put("Timeout", True)
End If
Return mapResult
End Sub