/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="callback">The callback to receive the result of message sending.</param>
        public ControlClientReceivingMessages( ISendCallback callback )
        {
            session = Diffusion.Sessions.Principal( "control" ).Password( "password" )
                .Open( "ws://diffusion.example.com:80" );

            var messagingControl = session.GetMessagingControlFeature();

            // Register to receive all messages sent by clients on the "foo" branch.
            // To do this, the client session must have the REGISTER_HANDLER permission.
            messagingControl.AddMessageHandler( "foo", new EchoHandler( messagingControl, callback ) );
        }
示例#2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="callback">The callback to receive the result of message sending.</param>
        public ControlClientReceivingMessages(ISendCallback callback)
        {
            session = Diffusion.Sessions.Principal("control").Password("password")
                      .Open("ws://diffusion.example.com:80");

            var messagingControl = session.GetMessagingControlFeature();

            // Register to receive all messages sent by clients on the "foo" branch.
            // To do this, the client session must have the REGISTER_HANDLER permission.
            messagingControl.AddMessageHandler("foo", new EchoHandler(messagingControl, callback));
        }
 /// <summary>
 /// Sends a simple string message to a specified topic path.
 ///
 /// There will be no context with the message so callback will be directed to the 'no context' callback.
 /// </summary>
 /// <param name="topicPath">The topic path.</param>
 /// <param name="message">The message to send.</param>
 /// <param name="callback">Notifies that the message was sent.</param>
 public void Send( string topicPath, string message, ISendCallback callback )
 {
     messaging.Send( topicPath, Diffusion.Content.NewContent( message ), callback );
 }
 /// <summary>
 /// Sends a string message to a specified topic with headers.
 ///
 /// There will be no context with the message so callback will be directed to the 'no context' callback.
 /// </summary>
 /// <param name="topicPath">The topic path.</param>
 /// <param name="message">The message to send.</param>
 /// <param name="headers">The headers to send with the message.</param>
 /// <param name="callback">Notifies that the message was sent.</param>
 public void SendWithHeaders( string topicPath, string message, List<string> headers, ISendCallback callback )
 {
     messaging.Send( topicPath, Diffusion.Content.NewContent( message ),
         messaging.CreateSendOptionsBuilder().SetHeaders( headers ).Build(), callback );
 }
 public EchoHandler( IMessagingControl messagingControl, ISendCallback sendCallback )
 {
     theMessagingControl = messagingControl;
     theSendCallback = sendCallback;
 }
示例#6
0
 public EchoHandler(IMessagingControl messagingControl, ISendCallback sendCallback)
 {
     theMessagingControl = messagingControl;
     theSendCallback     = sendCallback;
 }
示例#7
0
 /// <summary>
 /// Sends a string message to a specified topic with headers.
 ///
 /// There will be no context with the message so callback will be directed to the 'no context' callback.
 /// </summary>
 /// <param name="topicPath">The topic path.</param>
 /// <param name="message">The message to send.</param>
 /// <param name="headers">The headers to send with the message.</param>
 /// <param name="callback">Notifies that the message was sent.</param>
 public void SendWithHeaders(string topicPath, string message, List <string> headers, ISendCallback callback)
 {
     messaging.Send(
         topicPath,
         Diffusion.Content.NewContent(message),
         messaging.CreateSendOptionsBuilder().SetHeaders(headers).Build(),
         callback);
 }
示例#8
0
 /// <summary>
 /// Sends a simple string message to a specified topic path.
 ///
 /// There will be no context with the message so callback will be directed to the 'no context' callback.
 /// </summary>
 /// <param name="topicPath">The topic path.</param>
 /// <param name="message">The message to send.</param>
 /// <param name="callback">Notifies that the message was sent.</param>
 public void Send(string topicPath, string message, ISendCallback callback)
 {
     messaging.Send(topicPath, Diffusion.Content.NewContent(message), callback);
 }
示例#9
0
 public void setCallback(ISendCallback i)
 {
     callback = i;
 }