Xano now offers real-time functionality powered by WebSockets, enabling you to maintain an always-open connection between your Xano backend and your front-end application. This unlocks new possibilities for building real-time features like chat rooms, live notifications, and more, without relying on third-party services.
To get started with real-time functionality, follow these steps:
Real-time channels are where messages or events are sent and received. To set up a channel:
To connect to a real-time channel from your front-end application, you'll need:
With these values, you can use the Xano JavaScript SDK to establish a real-time connection:
This code snippet imports the Xano SDK, creates a client with your connection details, connects to the specified channel, listens for incoming messages, and sends a message to the channel.
Xano's documentation provides more details on using the JavaScript SDK and connecting to real-time channels from various front-end frameworks.
Once connected to a channel, you can send and receive messages in real-time. Xano's real-time functionality supports different message types and events, such as:
To send a message, use the `channel.send()` method:
To listen for incoming messages, use the `channel.on('message', callback)` method:
Xano's real-time functionality integrates with function stacks, allowing you to execute logic based on real-time events. You can use real-time triggers to log messages, perform filtering, or take any other desired action.
To set up a real-time trigger:
Within the function stack, you'll have access to various inputs related to the real-time event, such as the channel name, client information, and the message payload.
Xano's real-time functionality opens up a world of possibilities for building responsive, interactive applications without the need for third-party services or complex setup. By following the steps outlined in this guide, you can enable real-time, configure channels, connect from your front-end, and leverage real-time triggers in your function stacks.
As always, the Xano community (community.xano.com) and support team are available to assist with any questions or issues you may encounter while working with real-time functionality.
This transcript was AI generated to allow users to quickly answer technical questions about Xano.
I found it helpful
I need more support