Ciphix Websockets
Overview
Our WebSocket widget is designed to make real-time communication in Mendix applications incredibly easy to implement. With just a few simple steps, you can have a fully functioning WebSocket setup, keeping server load minimal by using a single socket with multiple subscribers. The widget allows you to send non-persistable objects directly to the client, and you can easily extend these objects with custom attributes like integers, dates, or enumerations. It's flexible, efficient, and works seamlessly with other modules, providing a hassle-free way to manage WebSocket connections in your app.
Documentation
Description
Effortlessly integrate real-time communication into your Mendix applications with our easy-to-implement WebSocket widget. Enjoy advanced features and flexible options.
Key features
- Single WebSocket for multiple subscribers to reduce server load; add subscriber widgets as needed on your pages. You can even use conditional visibility to change what an action does on a page.
- Automatically maintains WebSocket connections (ping/pong) with callbacks for connection issues (e.g., failed, lost, or re-established connections).
- Send non-persistable objects to the client that can be used in actions.
- Send a custom non-persistable objects with additional attributes (integers, enumerations, dates, etc.) that can also directly be used on the action.
- Compatible with secondary widgets such as our Chat widget, keeping WebSockets generic and lightweight.
- Send messages to individual users, all users, or all except anonymous users.
- Monitor active WebSocket connections and receive reports.
- Close all open WebSocket connections as needed.
Installation
Follow the simple steps below to set up the WebSocket widget in your Mendix app.
Minimal Setup:
- Add ASU_Websockets to your after startup flow.
- Insert the snippet SNIP_BizzomateWebsockets into your layouts or master layout. If you only need the WebSocket on a specific page, add the snippet there instead.
- Add one or more subscriber widgets. You can start with the BizzomateWebsocketSubscriber building block and adjust the handler name to something logical (e.g., on-receive-message) and add a custom on message action.
- Create a microflow that triggers the action, using ACT_GenericPayload_Send_Example_ToAllSessions as a reference. Ensure the handler name matches the one set in step 3.
That’s it!
Custom entities
To send additional attributes, extend the GenericPayload entity. For example, if you want to send a status enumeration to the client, extend the GenericPayload entity, add the desired attribute, and fill it in within your send message microflow. It will then automatically be available in the on message action of the BizzomateWebsocketSubscriber widget.