コード例 #1
0
        static async void TrySendRpc()
        {
            try
            {
                var res = await PitayaCluster.Rpc <NPitaya.Protos.RPCRes>(Route.FromString("csharp.testRemote.remote"),
                                                                          null);

                Console.WriteLine($"Code: {res.Code}");
                Console.WriteLine($"Msg: {res.Msg}");
            }
            catch (PitayaException e)
            {
                Logger.Error("Error sending RPC Call: {0}", e.Message);
            }
        }
コード例 #2
0
        private Task SendRequestToFront(string route, bool includeData)
        {
            var sessionProto = new Protos.Session
            {
                Id  = _id,
                Uid = Uid
            };

            if (includeData)
            {
                sessionProto.Data = ByteString.CopyFromUtf8(_rawData);
            }
            Console.WriteLine($"sending {sessionProto}");
            return(PitayaCluster.Rpc <Response>(_frontendId, Route.FromString(route), sessionProto.ToByteArray()));
        }
コード例 #3
0
    private void SendRpcButtonClicked()
    {
        var msg = new Protos.RPCMsg {
            Msg = inputRPC.text
        };

        try
        {
            // var res = PitayaCluster.Rpc<Protos.RPCRes>(Route.FromString("csharp.testremote.remote"), msg);
            var res = PitayaCluster.Rpc <Protos.RPCRes>(Route.FromString("room.room.test"), msg).Result;
            Debug.Log($"received rpc res: {res.Msg}");
        }
        catch (Exception e)
        {
            Debug.Log(e.Message);
        }
    }
コード例 #4
0
ファイル: Program.cs プロジェクト: topfreegames/NPitaya
 static async void TrySendRpc()
 {
     Logger.Info("Sending RPC....");
     try
     {
         var res = await PitayaCluster.Rpc<NPitaya.Protos.MyResponse>(
             Route.FromString("csharp.testRemote.remote"),
             new NPitaya.Protos.RPCMsg
             {
                 Route = "random.route.man",
                 Msg = "HEY",
             }
         );
         Console.WriteLine("GOT MESSAGE!!!");
         Console.WriteLine($"Code: {res.Code}");
         Console.WriteLine($"Msg: {res.Msg}");
         PitayaCluster.ObserveHistogram("my_histogram", 3, new []{"its_value"});
     }
     catch (PitayaException e)
     {
         Logger.Error("Error sending RPC Call: {0}", e.Message);
     }
 }