public void Unsubscribe(MqSite mqSite) { if (Sites.Remove(mqSite) && status == Status.Connected) { var msg = new MqUnsubscribe(); msg.Add(mqSite.remotePath); Send(msg); } }
public static MqMessage Parse(byte header, uint len, MemoryStream stream) { MqMessage msg = null; switch ((MessageType)((header & 0xf0) >> 4)) { case MessageType.CONNECT: msg = new MqConnect(header, len, stream); break; case MessageType.CONNACK: msg = new MqConnack(header, len, stream); break; case MessageType.DISCONNECT: msg = new MqDisconnect(header, len, stream); break; case MessageType.PINGREQ: msg = new MqPingReq(header, len, stream); break; case MessageType.PINGRESP: msg = new MqPingResp(header, len, stream); break; case MessageType.PUBLISH: msg = new MqPublish(header, len, stream); break; case MessageType.SUBSCRIBE: msg = new MqSubscribe(header, len, stream); break; case MessageType.SUBACK: msg = new MqSuback(header, len, stream); break; case MessageType.UNSUBSCRIBE: msg = new MqUnsubscribe(header, len, stream); break; case MessageType.UNSUBACK: msg = new MqUnsuback(header, len, stream); break; case MessageType.PUBACK: case MessageType.PUBCOMP: case MessageType.PUBREC: case MessageType.PUBREL: msg = new MqMsgAck(header, len, stream); break; } return(msg); }
public static MqMessage Parse(byte header, uint len, MemoryStream stream) { MqMessage msg=null; switch((MessageType)((header & 0xf0) >> 4)) { case MessageType.CONNECT: msg=new MqConnect(header, len, stream); break; case MessageType.CONNACK: msg=new MqConnack(header, len, stream); break; case MessageType.DISCONNECT: msg=new MqDisconnect(header, len, stream); break; case MessageType.PINGREQ: msg=new MqPingReq(header, len, stream); break; case MessageType.PINGRESP: msg=new MqPingResp(header, len, stream); break; case MessageType.PUBLISH: msg=new MqPublish(header, len, stream); break; case MessageType.SUBSCRIBE: msg=new MqSubscribe(header, len, stream); break; case MessageType.SUBACK: msg=new MqSuback(header, len, stream); break; case MessageType.UNSUBSCRIBE: msg=new MqUnsubscribe(header, len, stream); break; case MessageType.UNSUBACK: msg=new MqUnsuback(header, len, stream); break; case MessageType.PUBACK: case MessageType.PUBCOMP: case MessageType.PUBREC: case MessageType.PUBREL: msg=new MqMsgAck(header, len, stream); break; } return msg; }
public void Unsubscribe(string path) { MqUnsubscribe msg=new MqUnsubscribe(); msg.Add(path); Send(msg); }