/// <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> /// 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; }
public EchoHandler(IMessagingControl messagingControl, ISendCallback sendCallback) { theMessagingControl = messagingControl; theSendCallback = sendCallback; }
/// <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); }
/// <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); }
public void setCallback(ISendCallback i) { callback = i; }