void SendToServer(JSONObject args, RequestType type, string request)
        {
            JSONObject message = new JSONObject();

            message.AddField("type", type.ToString());
            message.AddField("request", request);
            message.AddField("args", args);
            client.PublishMessage(message.ToString());
        }
Beispiel #2
0
        // Update is called once per frame
        public void SendServiceMessage(JSONObject content, Functions func, bool justSymmetricKey = false)
        {
            timer = new System.Diagnostics.Stopwatch();
            seqNumber++;
            JSONObject data = new JSONObject();

            data.AddField("content", content);
            data.AddField("reply_to", client.RoutingKey);
            data.AddField("sender", playerId);
            data.AddField("seq_id", seqNumber);
            data.AddField("type", RequestType.service.ToString());
            data.AddField("function", func.ToString());
            JSONObject final = CalculateFinalSecureJson(data, justSymmetricKey);

            if (func != Functions.heartbeat)
            {
                WriteToConsole("SendMessageToServer: " + data.ToString());
            }
            timer.Start();
            client.PublishMessage(final.ToString());
        }