Skip to content

Push Service RC changes including new 'pushm' message type

ear-dev edited this page Mar 25, 2021 · 2 revisions

Viasat Push Service - Rocket.Chat Changes

Viasat Push Service sends the notification received from web hosts as direct messages to the end user. These notifications are displayed as rich messages in the direct room, therefore several message behavioural and schema were done to accommodate this.

Push Message schema flags

These flags were added to the standard Message Schema:

  • pushm - Flag to indicate that this is a push message sent by the push service, sent via REST call
  • pushm_post_processed - Boolean flag indicating if the push message is post processed by the target web host service worker defaults to false
  • pushm_scope - Scope of the web host service worker, this will be used to send the message to SW for post processing, sent via REST call
  • pushm_origin - Origin of the SW, this is used to monitor for post processed push message, sent via REST call

These flags are set before saving the message received via chat.postMessage REST API call by Push Service.

  • post_processed_message - Post processed message is saved using this key as part of Message object.

Push Message Rendering Behaviour

Push messages which are not post processed should not be rendered till it's post processed (Currently they are rendering for testing purpose). A new message UI subtype PushMessage is created to display push messages as rich message. Before rendering it as a Rich Message, it checks if the message is post processed. Post processed messages are rendered instantly. Messages which are not post processed are sent to target service workers for post processing via dispatchMessage browser method.

Once the post processed message is received from the monitorNotification promise, it's saved as post_processed_message in the message object and the original message which was not processed and sent by the push service is deleted. This post_processed_message is displayed as rich message.

Clone this wiki locally