Chat/Push notifications

Ask tech team
From QuickBlox Developers (API docs, code samples, SDK)
Jump to: navigation, search

Contents

Chat: Incoming message alerts (push notifications) for offline users

Push notification alerts are typically used in:

  1. 1:1 Chat when user is sending IM message / file attachment to other user but the other user went offline
  2. Group chat / any other social interaction where there has been some activity related to what current user is tracking (own chat message/post, topic of interest etc)

The offline user ('offline' meaning user has either quit the app or has lost the internet connection) is in such case being sent a push notification alert.

This is a really great way to inform users about activity happening in their absence, improve reaction time for offline users and increase user retention time users spend in your app.

Maximum message length for push notification

Typical message length for push notifications is 255 / 256 bytes (symbols) for iOS 7 and 2 kbytes for iOS 8+, however that may vary between platforms.

If you just send text you have 2028 (iOS 8+) or 236 (iOS 7-) characters available.

On iOS with APNS for example you may send a push notification of 255 bytes however only 107 characters will be displayed in the pop-up alert and everything after that will be truncated with "…" symbol (see also: http://stackoverflow.com/questions/6307748/what-is-the-maximum-length-of-a-push-notification-alert-text).

Message content (text)

Regarding the content of the message you may choose to send a:

  • Generic message ("New incoming chat message")
  • Summary on new / unread messages ("5 new chat messages"
  • excerpt from incoming chat message (most informative) specifying who is this coming from + initial part of the message ("Kevin: hi man how are you doing?")

Message content (media)

QuickBlox supports Rich Push which technically means you send a push notification through Messages API which also contains a pointer to a piece of rich media content (html, images, video) via Content API and your app displays that (once message is clicked on) as rich media content unlike simple textual push notifications.

Additional push parameters

When sending a push notification alert you may, in addition to sending a text message, also adjust other parameters, for example for iOS you may

  • Update a badge counter
  • Play a pre-defined sound

Waking the app by push notification

  1. App listening to push instructions - in iOS and some other platforms, in case the app has been minimized (so user doesn't see it but it is still waiting somewhere in the background) you may set up your app to listen to incoming push notifications for some specific instructions and once push message is received, to perform some action (for example bring the app to the desktop and answer an incoming video call).
  2. Push triggering action in the app - the above way only works when the app is in hibernate mode but what if you want for the push to trigger the action in apps that are not running - i.e. to launch the app? In such case you may connect your push alert button (for example "Reply" as opposed to "Ignore") to a specific action within specific UI in the app.

A very typical use case for this is if user has responded "Reply" (could be "OK", "Answer" etc) to incoming chat / call then to take user to specific chat interface within the app displaying the particular dialog / call with particular user. This is really neat and is a good practice.

Cross platform push notifications

QuickBlox supports push messaging on ALL mobile platforms (iOS, Android, BlackBerry, Windows Phone), also Web/Desktop is supported via in-app pull messaging and socket push. All these along with e-mails are available as Channels under Messages API. This allows you to ensure the push alert is delivered to every user on every platform.

Managing push notifications queue

Messages queue can be managed both via API and admin panel.

  1. When sending the message (you may apply settings such as delayed delivery (date/time) and recurring message.)
  2. After message is sent

You may remove/modify messages in the queue including batch removal where messages haven't been processed yet by one of QuickBlox Push Notification Daemons.

Once message has been processed, it is sent to relevant platform's push messaging service (such as APNS) and then QuickBlox has no control of what happens there. Here it is important to understand that all push notification services (Apple, Google, BlackBery, Microsoft) do not guarantee

  1. that message will be delivered at all;
  2. any time frames of when the message is going to be delivered. Also known with APNS and others that if the end user has no internet connection, the push message is not going to be delivered and when the app sends multiple push messages during offline time, only the last one is going to be delivered.