Private Sub ws_TextMessage(msg As String)
Try
' {"prop":"StartOrStop","etype":"runFunction","value":["start",3]}
Dim jp As JSONParser
jp.Initialize(msg)
Dim m As Map = jp.NextObject
Dim etype As String = m.get("etype")
Dim params As List = m.get("value")
Dim Event As String = m.get("prop")
If etype = "runFunction" Then
CallSub2(CallBack, EventName & "_" & Event, params) ==> wsh_StartOrStop(Params As List)
End If
Catch
Log("TextMessage Error: " & LastException)
Log(msg)
End Try
End Sub
Sub wsh_StartOrStop(Params As List)
If Params.Size <> 2 Then
wsengine.PostMsgLog($"StartOrStop.Param<>2"$)
Return
End If
Dim cmd As String = Params.Get(0)
Dim n1 As Int = engine.StartOrStop(cmd)
wsengine.Authorizing = Params.Get(1)
If wsengine.Authorizing >= 0 Then
cdt.Enabled = False
Else
If cmd.ToLowerCase="start" Then
wsengine.PostWarLog($"Each start is limited to 2 hours and the timing starts"$)
cdt.Enabled = True
Else
cdt.Enabled=False
End If
End If
cdn = 2*60*60
wsengine.PostMsgLog($"StartOrStop.${Params.Get(0)} = ${jylab.IIF2(n1=1,"success","fail")}"$)
End Sub