peacemaker Expert Licensed User Longtime User Jan 24, 2017 #1 Hi, All Who already used Google Firebase cloud messaging ? If the each message is limited by some digit around 4K bytes - how to control it ? If message prepared is longer ? Will it be some sending error or what ? Last edited: Jan 24, 2017
Hi, All Who already used Google Firebase cloud messaging ? If the each message is limited by some digit around 4K bytes - how to control it ? If message prepared is longer ? Will it be some sending error or what ?
DonManfred Expert Licensed User Longtime User Jan 24, 2017 #2 Did you tried to send 16kb? It should raise an error cause it is more than the allowed size Upvote 0
peacemaker Expert Licensed User Longtime User Jan 24, 2017 #3 Not tried, and asking. So, we must check the JSON generated text to be sent before sending... How to be sure if data is variable.... OK, thanks, DonManfred Upvote 0
Not tried, and asking. So, we must check the JSON generated text to be sent before sending... How to be sure if data is variable.... OK, thanks, DonManfred
DonManfred Expert Licensed User Longtime User Jan 24, 2017 #4 peacemaker said: How to be sure if data is variable.... Click to expand... Yes. Check the length of the jsonstring before sending.... Upvote 0
peacemaker said: How to be sure if data is variable.... Click to expand... Yes. Check the length of the jsonstring before sending....
Erel B4X founder Staff member Licensed User Longtime User Jan 24, 2017 #5 And the answer is: Code: Sub AppStart (Args() As String) Dim sb As StringBuilder sb.Initialize For i = 1 To 16000 sb.Append("a") Next SendMessage("general", "title", sb.ToString) StartMessageLoop End Sub Output: {"error":"MessageTooBig"} [jobname=fcm, success=false, username= , password=, errormessage=Bad Request, target=class b4j.example.main , taskid=1, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@2d98a335, tag=java.lang.Object@16b98e56 , httputils2service=null] Upvote 0
And the answer is: Code: Sub AppStart (Args() As String) Dim sb As StringBuilder sb.Initialize For i = 1 To 16000 sb.Append("a") Next SendMessage("general", "title", sb.ToString) StartMessageLoop End Sub Output: {"error":"MessageTooBig"} [jobname=fcm, success=false, username= , password=, errormessage=Bad Request, target=class b4j.example.main , taskid=1, req=anywheresoftware.b4h.okhttp.OkHttpClientWrapper$OkHttpRequest@2d98a335, tag=java.lang.Object@16b98e56 , httputils2service=null]