Пример #1
0
        private void sendMessageFragment(RemoteMessage remoteMsg, string fPayload, string fAttachment, int fragmentIndex, bool lastFragment)
        {
            RemoteMessage fRemoteMessage = new RemoteMessage();

            fRemoteMessage.id                  = remoteMsg.id;
            fRemoteMessage.method              = remoteMsg.method;
            fRemoteMessage.type                = remoteMsg.type;
            fRemoteMessage.packageName         = remoteMsg.packageName;
            fRemoteMessage.remoteApplicationID = remoteMsg.remoteApplicationID;
            fRemoteMessage.remoteSourceSDK     = remoteMsg.remoteSourceSDK;
            fRemoteMessage.version             = remoteMsg.version;

            // changes for the fragment
            fRemoteMessage.payload            = fPayload;
            fRemoteMessage.attachmentUri      = null;
            fRemoteMessage.attachmentEncoding = remoteMsg.attachmentEncoding ?? "BASE64.FRAGMENT";
            fRemoteMessage.attachment         = fAttachment;
            fRemoteMessage.fragmentIndex      = fragmentIndex;
            fRemoteMessage.lastFragment       = lastFragment;

            string msg = JsonUtils.SerializeSdk(fRemoteMessage);

            transport.sendMessage(msg);

#if DEBUG
            Console.WriteLine("Sent message: " + msg);
#endif
        }
Пример #2
0
        private void doPong()
        {
            // Send special Pong message
            RemoteMessage remoteMessage = RemoteMessage.CreatePongMessage(packageName, remoteSourceSDK, remoteApplicationID);
            string        msg           = JsonUtils.SerializeSdk(remoteMessage);

            transport.sendMessage(msg);
#if DEBUG
            Console.WriteLine("Sent message: " + msg);
#endif
        }
Пример #3
0
        private string sendObjectMessage(Message message)
        {
            RemoteMessage remoteMessage = RemoteMessage.createMessage(message.method, MessageTypes.COMMAND, message, this.packageName, remoteSourceSDK, remoteApplicationID);
            string        msg           = JsonUtils.SerializeSdk(remoteMessage);

            transport.sendMessage(msg);
#if DEBUG
            Console.WriteLine("Sent message: " + msg);
#endif
            return(remoteMessage.id);
        }
Пример #4
0
        public static RemoteMessage createMessage(Methods meth, MessageTypes msgType, Message payload, string packageName, string remoteSourceSDK, string remoteApplicationID)
        {
            RemoteMessage msg = new RemoteMessage();

            msg.method = meth;
            msg.type   = msgType;
            if (null == payload)
            {
                payload = new Message(meth);
            }
            msg.payload             = JsonUtils.SerializeSdk(payload);
            msg.packageName         = packageName;
            msg.remoteSourceSDK     = remoteSourceSDK;
            msg.remoteApplicationID = remoteApplicationID;
            msg.id = nextID();
            return(msg);
        }