Hi all,
I'm in the process of updating my FCM dispatcher hosted by a multi-purpose jetty server ran on a VPS.
Fundamentally, some desktop and mobile apps are allowed to send "packets" to an handler and, based on some internal rules, an FCM message is sent to a topic or a single device.
Reading the updated FCM tutorial, I have a few questions.
Token renewal
1. I've read that a token expires in 60 minutes. So, keeping track of the last time it was requested, I guess it will be safe to execute GetTokenValue after at least 30 minutes from last request instead of requesting it for each message.
2. InputStream. To get GoogleCredentials we have:
<code>
GoogleCredentials.RunMethodJO("fromStream", Array(File.OpenInput(FilePath, ""))
</code>
Would it be wrong to have a statement like
<code>
Private SAInputStream As InputStream = File.OpenInput(ServiceAccountFilePath, "")
'....
'Private Sub GetTokenValue (FilePath As String) As String
'...
Dim Credentials As JavaObject = GoogleCredentials.RunMethodJO("fromStream", Array(SAInputStream))
</code>
thus reading from the disk file just once?
3. In original code, could repeatedly calling File.OpenInput leads to memory leaks since nothing closes the stream? I understand that the original code is terminated after sending the first and only test message (ExitApplication in sub Send), but what about the above described use case?
FCM messages
While writing this post I can't recall where to read about different styles of messages. I've got some notes somewhere..
Hoping that Goggle didn't change that aspect too. Anyway, we will found it.
TIA
I'm in the process of updating my FCM dispatcher hosted by a multi-purpose jetty server ran on a VPS.
Fundamentally, some desktop and mobile apps are allowed to send "packets" to an handler and, based on some internal rules, an FCM message is sent to a topic or a single device.
Reading the updated FCM tutorial, I have a few questions.
Token renewal
1. I've read that a token expires in 60 minutes. So, keeping track of the last time it was requested, I guess it will be safe to execute GetTokenValue after at least 30 minutes from last request instead of requesting it for each message.
2. InputStream. To get GoogleCredentials we have:
<code>
GoogleCredentials.RunMethodJO("fromStream", Array(File.OpenInput(FilePath, ""))
</code>
Would it be wrong to have a statement like
<code>
Private SAInputStream As InputStream = File.OpenInput(ServiceAccountFilePath, "")
'....
'Private Sub GetTokenValue (FilePath As String) As String
'...
Dim Credentials As JavaObject = GoogleCredentials.RunMethodJO("fromStream", Array(SAInputStream))
</code>
thus reading from the disk file just once?
3. In original code, could repeatedly calling File.OpenInput leads to memory leaks since nothing closes the stream? I understand that the original code is terminated after sending the first and only test message (ExitApplication in sub Send), but what about the above described use case?
FCM messages
While writing this post I can't recall where to read about different styles of messages. I've got some notes somewhere..
Hoping that Goggle didn't change that aspect too. Anyway, we will found it.
TIA