Wednesday, July 8, 2015

XMPP Real-time Text in Action

XMPP Real-time Text is definitively one of the most fun XMPP extension out there, from user's point of view as well as from a developer's point of view! Recently I've added support for it in the upcoming version 0.6.0 and I thought I'd make a short video which demonstrates this cool new feature in action!

It shows how it could look like when two XMPP contacts are chatting with each other and having real-time text enabled. Enjoy!

Roughly speaking you have to create a new outbound real-time message and just update its text while typing:

// Create a chat session with another user.
Chat chat = xmppClient.getManager(ChatManager.class).createChatSession(contact);
RealTimeTextManager realTimeTextManager = xmppClient.getManager(RealTimeTextManager.class);
// Create an new RTT message.
OutboundRealTimeMessage realTimeMessage = realTimeTextManager.createRealTimeMessage(chat);
TextArea textArea = new TextArea();
textArea.textProperty().addListener((observable, oldValue, newValue) -> {

When done typing, commit the message (which will send the current message as normal chat message):


On the receiver side, you can listen for it like this (and e.g. display it to a Label).

Label label = new Label();
// Upon receiving a RTT message, display it.
realTimeTextManager.addRealTimeMessageListener(e -> {
    InboundRealTimeMessage rtt = e.getRealTimeMessage();
    rtt.addRealTimeTextChangeListener(e1 -> Platform.runLater(() -> label.setText(e1.getText())));


  1. This comment has been removed by the author.

  2. This comment has been removed by the author.

  3. I am the main author of XEP-0301.

    Congratulations on a great implementation of XEP-0301!
    I am pleased to hear you found it to be fun as a developer, and fun as a user.

    We'd like to hear your comments, if you found any deficiencies in the XEP-0301 standard (e.g. ambiguities, or confusions), for the next round of standard clarifications, if any are needed.

    Email -- mark [at]

  4. This comment has been removed by the author.

  5. Another great implementation is now found in

    The other developers (Lance Stout) agree that XEP-0301 is a fun standard as well; "There are of course more little implementation [UX] details and potential Unicode issues that the XEP-0301 spec covers, but the fundamental model is remarkably simple and fun to implement."

  6. Hi, is it possible if you could do a tutorial on how to implement this? I'm a complete beginner when it comes to xmpp libraries and plugins, and all I've got is a prosody server up and running. I'd love any tips or advice on how to have RTT. Thanks!