Skip to main content

Implementation of a chat app using the Pub/Sub method

Hexabase has the ability to publish events from the backend to the frontend. By using this feature, you can notify users on the front-end UI when items are updated, comments are registered, CSV import is completed, etc.

PubSub Model

Hexabase backend → There is a mechanism for notifying the frontend of events. It is based on the popular PubSub model and utilizes SSE (server-sent events) technology.

Comparison of WebSocket and SSE

There are several PubSub implementation methods available, the most popular of which is WebSocket. The main differences from SSE (server-sent events) used by Hexabase are as follows:

WebSocketSSE
PurposeGeneral-purpose, real-time system (games, chat, web, etc.)Web screen system that mainly uses HTTP communication (simple and limited use)
Communication directionBidirectional (Server <-> Browser)Unidirectional (Server -> Browser)
ProtocolUniqueHTTP
PerformanceHigh speedSame as HTTP communication
Specification stabilityNearly stableStable (defined as HTML5-related specifications)
Compatible browserCompatible with practically all browsers (older versions of Internet Explorer 8 and below are not supported).
Modern browser (IE11 is NG)
Time to cutRequires reconnection codeAuto-reconnect

Hexabase main events

The typical events that Hexabase notifies from the server side are as follows: This event is controlled by a microservice (notificator) in Hexabase, which checks the permissions of the logged-in user while controlling its transmission.

ClassificationEventIssue timingMain notification contents
Related itemAction execution (item creation, item update, etc.)When updating or creating a new itemInformation about the item change notification, such as ID
Post a commentWhen posting a comment (history) to an itemPosted comment text
CSV importCSV new importWhen the import is completeImport success, failure, error information, etc.
CSV update importWhen the import is completeImport success, failure, error information, etc.
ApplicationCreate a new application and restore templateWhen application creation is completeApplication information

Event Notifications to

Hexabase allows you to set who should be notified of events using groups and roles. This is set via the Item > Action menu > "Who should be notified of this action?"

The notification destination can be one of the following:

  • User who can see the item (user who owns the access key) + checked member
  • If a member with the role Subscribe

Event notification and chat implementation when posting comments

Using the Pub/Sub mechanism, the Hexabase UI can be redisplayed in real time when a comment is posted for an item.