Server part of server to client communication implementation.

Please do not forget before use to:

  • get up and running RabbitMQ
  • create user-notify topic exchange
  • get up and running rabbitmq-ub-router and rabbitmq-jwt-issuer services
  • configure application.customSettings.rabbitMQ section
  • configure uiSettings.adminUI.amqpNotificationUrl

Methods

broadcast(topic: string, message: object)→numberinner#

Send broadcast notification, to all connected clients

Return:

Event ID

Arguments info:

  • topic: string

    Message topic. name of the notification source this should be unique name to be able for client to distinguish the source of notification message

  • message: object

    the message to send any value is converted to JSON string before sending

entityEvent(entityName: string, instanceID: number, message: object, optionsopt: UBNotifyEntityEventOptions)→numberinner#

Send a notification about change to client

notifyUser(subjectIDs: number, message: object, subTopicopt: string)→numberinner#

Send notification to a particular user (subject).

Return:

Event ID

Arguments info:

  • subjectIDs: number

    If not specified, will be passed to Session.uData.userID. subjectID of the message recipient: UnityBase userID OR roleID or groupID If ORG model is used, could also be staffUnitID or departmentID or organizationID,

  • message: object

    The event data object to send, value is converted to JSON string before sending

  • subTopic: string

    name of the notification source this should be unique name to be able for client to distinguish the source of notification message