示例#1
0
        public static Envelope Unpack(string message)
        {
            JObject obj    = JObject.Parse(message);
            var     msg    = obj["message"];
            Message result = null;

            if (msg != null)
            {
                result = MessageSerializer.FromJObject((JObject)msg);
            }
            return(new Envelope
            {
                Message = result,
                ServiceName = obj["service"].ToString(),
                Subscribe = obj["subscribe"] == null ? string.Empty : obj["subscribe"].ToString(),
                Unsubscribe = obj["unsubscribe"] == null ? string.Empty : obj["unsubscribe"].ToString(),
            });
        }
示例#2
0
 public override string ToString()
 {
     return(MessageSerializer.Serialize(this));
 }