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.
- Sample application: hxChatt > https://github.com/b-eee/hxChatt
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:
WebSocket | SSE | |
---|---|---|
Purpose | General-purpose, real-time system (games, chat, web, etc.) | Web screen system that mainly uses HTTP communication (simple and limited use) |
Communication direction | Bidirectional (Server <-> Browser) | Unidirectional (Server -> Browser) |
Protocol | Unique | HTTP |
Performance | High speed | Same as HTTP communication |
Specification stability | Nearly stable | Stable (defined as HTML5-related specifications) |
Compatible browser | Compatible with practically all browsers (older versions of Internet Explorer 8 and below are not supported). | |
Modern browser (IE11 is NG) | ||
Time to cut | Requires reconnection code | Auto-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.
Classification | Event | Issue timing | Main notification contents |
---|---|---|---|
Related item | Action execution (item creation, item update, etc.) | When updating or creating a new item | Information about the item change notification, such as ID |
Post a comment | When posting a comment (history) to an item | Posted comment text | |
CSV import | CSV new import | When the import is complete | Import success, failure, error information, etc. |
CSV update import | When the import is complete | Import success, failure, error information, etc. | |
Application | Create a new application and restore template | When application creation is complete | Application 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.