/// <summary> /// Sends a message to the server. /// </summary> /// <param name="message">Message to be sent</param> /// <exception cref="CommunicationStateException">Throws a CommunicationStateException if client is not connected to the server.</exception> public void SendMessage(ICJiaMessage message) { if (CommunicationState != CommunicationStates.Connected) { throw new CommunicationStateException("Client is not connected to the server."); } _communicationChannel.SendMessage(message); }
/// <summary> /// Sends a message to the server. /// </summary> /// <param name="message">Message to be sent</param> /// <exception cref="CommunicationStateException"> /// Throws a CommunicationStateException if client is not connected to the server. /// </exception> public void SendMessage(IScsMessage message, byte priority) { if (CommunicationState != CommunicationStates.Connected) { throw new CommunicationStateException("Client is not connected to the server."); } _communicationChannel.SendMessage(message, priority); }
public void Listen(Func <TQuery, TResponse> processFunc) { var disposable = _queryChannel.MessageStream .Where(m => m != null && m.GetType() == typeof(TQuery)) .Cast <TQuery>() .Subscribe(m => _compositeDisposable.Add(_responseChannel.SendMessage(processFunc(m)).Subscribe())); _compositeDisposable.Add(disposable); }
public IObservable <TResponse> Query(TQuery parameter) { return(Observable.Create <TResponse>( observer => { return new CompositeDisposable { _responseChannel.MessageStream .Where(m => m != null && m.GetType() == typeof(TResponse)) .Cast <TResponse>() .Where(m => m.Id == parameter.Id) .Subscribe(observer), _queryChannel.SendMessage(parameter).Subscribe() }; })); }
/// <summary> /// Handles MessageReceived event of _communicationChannel object. /// /// </summary> /// <param name="sender">Source of event</param><param name="e">Event arguments</param> private void CommunicationChannel_MessageReceived(object sender, MessageEventArgs e) { IScsMessage message = e.Message; if (message is ScsPingMessage) { ICommunicationChannel communicationChannel = this._communicationChannel; ScsPingMessage scsPingMessage1 = new ScsPingMessage(); scsPingMessage1.RepliedMessageId = message.MessageId; ScsPingMessage scsPingMessage2 = scsPingMessage1; communicationChannel.SendMessage((IScsMessage)scsPingMessage2); } else { this.OnMessageReceived(message); } }
/// <summary> /// Sends a message to the client. /// </summary> /// <param name="message">Message to be sent</param> public void SendMessage(IScsMessage message) { _communicationChannel.SendMessage(message); }
/// <summary> /// Sends a message to the client. /// </summary> /// <param name="message">Message to be sent</param> public void SendMessage(IScsMessage message, byte priority) { _communicationChannel.SendMessage(message, priority); }
/// <summary> /// Sends a message to the client. /// </summary> /// <param name="message">Message to be sent</param> public void SendMessage(string message) { _communicationChannel.SendMessage(message); }
public void OnNext(T value) { _publishChannel.SendMessage(value).Subscribe(); }