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(), }); }
public override string ToString() { return(MessageSerializer.Serialize(this)); }