Typing indicators enable you to indicate if users are typing messages in a channel. This feature is easy to implement and can significantly improve the experience for your users.
You can trigger a typing event when a user starts typing a message. Other users in the channel receive these events in realtime to show typing indicators on the screen. Applications generally display a typing indicator for a few seconds before it expires, or continue display it if the user is still typing. The app hides the indicator when it receives the actual message.
For example, you might follow a pattern like this:
- Send a
typing_onevent when the user starts typing.
- Send another
typing_onevent if the user is still typing after 10 to 15 seconds.
- Send a
typing_offevent if the user removes the message they were typing.
Sending typing on/off events
signal() method to send transient events to indicate that a user is typing a message or has stopped typing.
By default, signals are limited to a message payload size of 30 bytes. This limit applies only to the payload, and not to the URI or headers. If you require a larger payload size, please contact support.
Receiving typing events
Typing events are published on the same channel as the original message. To receive them, you subscribe to the channel and add a listener for signals.
Note that signals are transient, and are handled differently than regular messages. You can't fetch signals from storage, and you only receive the most recent signal from the buffer queue via a subscribe request.