display.printHeader("You need to open the pong example page in order to run the example", Style.important);
display.printHeader("Ping to: " + other, Style.info);
new ChatManagerEventsSupervisor(chatManager, display);
final Chat chat = chatManager.open(other);
chat.addMessageReceivedHandler(new MessageHandler() {
@Override
public void onMessage(final MessageEvent event) {
display.print(("RECEIVED: " + event.getMessage().getBody()), Style.received);
}
});
// SEND THE FIRST PING WHEN THE CHAT IS READY
chat.addChatStateChangedHandler(true, new StateChangedHandler() {
@Override
public void onStateChanged(final StateChangedEvent event) {
if (event.is(ChatStates.ready)) {
sendPing(chat);
}