Skip to main content

Retrieving new messages

Polling

The default method is polling. The chat will get new messages from the API every X seconds. X can be one of the following [2s, 5s, 10s, 30s, 1m, 5m, 15m, 30m, 2h, 5h, 6h]. The chat will use X 5 times before it continues to the next set of seconds,

For example

  • First time the chat will get new messages from the API and wait 2 seconds
  • After it has done this 5 times it will wait 5 seconds before each request
  • After it has done this 5 times it will wait 10 seconds before each request
    etc

But when the page has focus (when the client is looking at the page), it will max to 30 seconds.
(In version1.2.20 we changed the rule to also check if you are within the defined business hours (weekdays setting), if you are outside these business hours the rule will go past 30 seconds)

Push

This method uses the Google's Firebase Cloud Messaging (FCM) for receiving push messages. Once the chat has ‘subscribed’ to FCM it will receive new messages when they are send by the agents. This means the chat does not have to actively poll for new messages.

For this to work your users browser needs to support both notifications and serviceworkers. You also need to host the firebase-messaging Javascript file and set your serviceWorkerLocation accordingly in the Settings. Your client will need to accept notifications when the browser asks for it. (you cannot host the Javascript file on a different domain than the chat, see why)

When the chat has successfully setup Firebase Messaging (Google Firebase library for retrieving push notifications) it will disable polling by setting a value in the localStorage to ‘true’ (value name is pushReady, whenever this value is ‘false’ the chat will use polling).

What personal data does Google store?

Google’s Firebase Cloud Messaging (FCM) keeps track of the ID of the devices that receive push notifications. This ID contains no personal data and consists of numbers and letters.

Google's own explanation about this:

Personal dataHow it helpsRetention
Instance IDsFirebase Cloud Messaging uses Instance IDs to determine which devices to deliver messages to.Firebase retains Instance IDs until the Firebase customer makes an API call to delete the ID. After the call, data is removed from live and backup systems within 180 days.

source: Firebase's privacy statement