Sub fm_MessageArrived(Message As RemoteMessage)
Dim messageData As Map
Dim action As String, targetDevice As Int
Log("Message arrived")
Log($"Message data: ${Message.GetData}"$)
messageData = Message.GetData
targetDevice = messageData.Get("device_id")
If ((targetDevice<>Settings.RegNumber) And (targetDevice<>0)) Then
Return
End If
fmSendSettings
End Sub
Private Sub fmSendSettings()
Dim sMsg, JSONString As String
Dim js As JSONGenerator
Dim j As HttpJob
'....
'....
'js is a properly constructed json
JSONString = js.ToString
msg = JSONString
j.Initialize("", Me)
j.PostString(Settings.ServerbaseUrl & Settings.SyncUrlFile, msg)
Wait For (j) JobDone(j As HttpJob)
If (j.Success) Then
Log ("Get string:" & CRLF & j.GetString)
End If
j.Release
End Sub