Ejemplo n.º 1
0
  byte[] sendMessageData(TLObject message, long messageId) {
    byte[] messageData;
    SerializedData innerOs = new SerializedData();
    message.serializeToStream(innerOs);
    messageData = innerOs.toByteArray();

    SerializedData messageOs = new SerializedData();
    messageOs.writeInt64(0);
    messageOs.writeInt64(messageId);
    messageOs.writeInt32(messageData.length);
    messageOs.writeRaw(messageData);

    byte[] transportData = messageOs.toByteArray();

    datacenter.connection.sendData(transportData, false, false);

    return transportData;
  }
Ejemplo n.º 2
0
 public int postMessageDelayed(
     TLObject object,
     boolean isRpc,
     long timeout,
     int delay,
     int contextId,
     boolean highPrioroty) {
   int id = messagesIds.incrementAndGet();
   SchedullerPackage schedullerPackage = new SchedullerPackage(id);
   schedullerPackage.object = object;
   schedullerPackage.addTime = getCurrentTime();
   schedullerPackage.scheduleTime = schedullerPackage.addTime + delay;
   schedullerPackage.expiresTime = schedullerPackage.scheduleTime + timeout;
   schedullerPackage.ttlTime = schedullerPackage.scheduleTime + timeout * 2;
   schedullerPackage.isRpc = isRpc;
   schedullerPackage.queuedToChannel = contextId;
   schedullerPackage.priority = highPrioroty ? PRIORITY_HIGH : PRIORITY_NORMAL;
   schedullerPackage.isDepend = highPrioroty;
   schedullerPackage.supportTag = object.toString();
   messages.put(id, schedullerPackage);
   return id;
 }