예제 #1
0
        void SendHeartbeat()
        {
            var frame = new PushFrame <IDictionary <string, string> > {
                Topic   = "phoenix",
                Event   = "heartbeat",
                Payload = new Dictionary <string, string>(),
                Ref     = MakeRef()
            };
            var json = JsonConvert.SerializeObject(frame);

            Send(json);
        }
예제 #2
0
        public IObservable <JObject> Send <T>(string evt, T payload)
        {
            var frameRef = manager.MakeRef();
            var frame    = new PushFrame <T>
            {
                Topic   = topic,
                Event   = evt,
                Payload = payload,
                Ref     = frameRef
            };
            var json = JsonConvert.SerializeObject(frame);

            var ret = observable.FirstAsync(x => x["event"].Value <string>() == "phx_reply" && x["ref"].Value <UInt64>() == frameRef);

            manager.Send(json);

            return(ret);
        }