Package com.calclab.emite.core.client.xmpp.stanzas

Examples of com.calclab.emite.core.client.xmpp.stanzas.Message


    /**
     * The simplest way to send a message using the Session object
     */
    private void sendHelloWorldMessage(final Session session) {
  final Message message = new Message("hello world!", uri("everybody@world.org"));
  session.send(message);
    }
View Full Code Here


  connection.onStanzaReceived(new Listener<IPacket>() {
      public void onEvent(final IPacket stanza) {
    final String name = stanza.getName();
    if (name.equals("message")) {
        onMessage.fire(new Message(stanza));
    } else if (name.equals("presence")) {
        onPresence.fire(new Presence(stanza));
    } else if (name.equals("iq")) {
        final String type = stanza.getAttribute("type");
        if ("get".equals(type) || "set".equals(type)) {
View Full Code Here

    output.print("You need to open the ping example page in order to run the example", Style.important);

    session.addMessageReceivedHandler(new MessageHandler() {
      @Override
      public void onMessage(final MessageEvent event) {
        final Message message = event.getMessage();
        output.print(("RECEIVED: " + message.getBody()), Style.received);
        pongs++;
        final String body = "Pong " + pongs + " [" + System.currentTimeMillis() + "]";
        session.send(new Message(body, other));
        output.print("SENT: " + body, Style.sent);
      }
    });

  }
View Full Code Here

  private void listenToChat(final Chat chat) {
    chat.addMessageReceivedHandler(new MessageHandler() {
      @Override
      public void onMessage(final MessageEvent event) {
        final Message message = event.getMessage();
        display.print(("RECEIVED: " + message.getBody()), Style.received);
        pongs++;
        final String body = "Pong " + pongs + " [" + System.currentTimeMillis() + "]";
        chat.send(new Message(body));
        display.print("SENT: " + body, Style.sent);

      }
    });
  }
View Full Code Here

    // Because is a RoomManager, we know this MUST be a room
    final Room room = (Room) roomManager.open(roomUri);
    room.addMessageReceivedHandler(new MessageHandler() {
      @Override
      public void onMessage(final MessageEvent event) {
        final Message message = event.getMessage();
        display.print(("RECEIVED: " + message.getBody()), Style.received);
        pongs++;
        if (room.isUserMessage(message) && !room.isComingFromMe(message)) {
          final String body = "Pong " + pongs + " [" + System.currentTimeMillis() + "]";
          room.send(new Message(body));
          display.print("SENT: " + body, Style.sent);
        }
      }
    });
  }
View Full Code Here

  private void sendPing() {
    if (session.isReady()) {
      pings++;
      waitTime += 500;
      final String body = "Ping " + pings + " [" + System.currentTimeMillis() + "]";
      session.send(new Message(body, other));
      output.print("SENT: " + body, Style.sent);
      new Timer() {
        @Override
        public void run() {
          sendPing();
View Full Code Here

      @Override
      public void onStateChanged(final StateChangedEvent event) {
        if (event.is(ChatStates.ready)) {
          display.print("We entered the room: " + room.getURI(), Style.info);
          pongs++;
          room.send(new Message("Pong " + pongs));
          closeRoom(manager, room);
        }
      }
    });
View Full Code Here

  protected void sendPing(final Chat chat) {
    if (chat.isReady()) {
      pings++;
      waitTime += 500;
      final String body = "Ping " + pings + " [" + System.currentTimeMillis() + "]";
      chat.send(new Message(body));
      display.print("SENT: " + body, Style.sent);
      new Timer() {
        @Override
        public void run() {
          sendPing(chat);
View Full Code Here

TOP

Related Classes of com.calclab.emite.core.client.xmpp.stanzas.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.