public void PushMsg(Msg msg) { Debug.Assert(m_options.SocketType == ZmqSocketType.Pub || m_options.SocketType == ZmqSocketType.Xpub); // The first message is identity. // Let the session process it. m_session.PushMsg(msg); // Inject the subscription message so that the ZMQ 2.x peer // receives our messages. msg = new Msg(1); msg.Put((byte)1); m_session.PushMsg(msg); m_session.Flush(); // Once we have injected the subscription message, we can // Divert the message flow back to the session. Debug.Assert(m_decoder != null); m_decoder.SetMsgSink(m_session); }
public void Plug(IOThread ioThread, SessionBase session) { m_session = session; m_socket = session.Socket; m_ioObject = new IOObject(null); m_ioObject.SetHandler(this); m_ioObject.Plug(ioThread); m_ioObject.AddFd(m_handle); m_ioObject.SetPollin(m_handle); DropSubscriptions(); // push message to the session because there is no identity message with pgm session.PushMsg(new Msg()); }