Package org.auto.comet

Examples of org.auto.comet.Socket.send()


        continue;
      }
      JSONObject message = new JSONObject();
      message.put(COMMAND_KEY, COMMAND_LOGIN);
      message.put("userId", userId);
      socket.send(message.toString());

      JSONObject message2 = new JSONObject();
      message2.put(COMMAND_KEY, COMMAND_LOGIN);
      message2.put("userId", id);
      userSocket.send(message2.toString());
View Full Code Here


    result.put(COMMAND_KEY, COMMAND_RECEIVE);
    result.put("userId", userId);
    result.put("text", message);
    String now = DateFormatUtils.format(new Date(), "HH:mm:ss");
    result.put("time", now);
    socket.send(result.toString());
  }

  @Override
  public void sendMessage(Serializable[] userIds, String message) {
    for (Serializable userId : userIds) {
View Full Code Here

  @Override
  public void sendMessage(Serializable[] userIds, String message) {
    for (Serializable userId : userIds) {
      Socket socket = socketMapping.get(userId);
      socket.send(message);
    }
  }

}
View Full Code Here

  public void send(Serializable id, String msg) {
    readLock.lock();
    try {
      Socket socket = this.socketMapping.get(id);
      if (null != socket) {
        socket.send(msg);
      } else {
        throw new RuntimeException("Can't find socket!");
      }
    } finally {
      readLock.unlock();
View Full Code Here

        Serializable id = entry.getKey();
        Socket socket = entry.getValue();
        if (id.equals(exceptId)) {
          continue;
        }
        socket.send(msg);
      }
    } finally {
      readLock.unlock();
    }
  }
View Full Code Here

  public void sendToAll(String msg) {
    readLock.lock();
    try {
      for (Entry<Serializable, Socket> entry : socketMapping.entrySet()) {
        Socket socket = entry.getValue();
        socket.send(msg);
      }
    } finally {
      readLock.unlock();
    }
  }
View Full Code Here

  public void send(Serializable id, String msg) {
    readLock.lock();
    try {
      Socket socket = this.socketMapping.get(id);
      if (null != socket) {
        socket.send(msg);
      } else {
        throw new RuntimeException("Can't find socket!");
      }
    } finally {
      readLock.unlock();
View Full Code Here

        Serializable id = entry.getKey();
        Socket socket = entry.getValue();
        if (id.equals(exceptId)) {
          continue;
        }
        socket.send(msg);
      }
    } finally {
      readLock.unlock();
    }
  }
View Full Code Here

  public void sendToAll(String msg) {
    readLock.lock();
    try {
      for (Entry<Serializable, Socket> entry : socketMapping.entrySet()) {
        Socket socket = entry.getValue();
        socket.send(msg);
      }
    } finally {
      readLock.unlock();
    }
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.