/// <summary> /// Starts Communicator to open communication medium with clients /// </summary> public void StartCommunicator() { // Check for Null Reference if (_communicator != null) { // Check if it not already connected if (!_communicator.IsConnected()) { // Connect Communication Server _communicator.Connect(); return; } if (Logger.IsInfoEnabled) { Logger.Info("Already connected", _type.FullName, "StartCommunicator"); } return; } if (Logger.IsInfoEnabled) { Logger.Info("Communicator object not initialized", _type.FullName, "StartCommunicator"); } }
public void Connect() { if (_communicator != null) { _communicator.Connect(); } }
private void CheckConnection() { if (!_communicator.IsConnected) { _communicator.Connect(); } }
/// <summary> /// Starts Communicator to open communication medium with clients /// </summary> public void StartCommunicator() { // Check for Null Reference if (_communicator != null) { // Connect Communication Server _communicator.Connect(); } }
public Task StartAsync(CancellationToken cancellationToken) { _logger.LogInformation("JobRunnerHostedService started"); _comm.Connect(); RegisterResponders(cancellationToken); return(Task.CompletedTask); }
/// <summary> /// Starts Communicator to open communication medium with clients /// </summary> public void StartCommunicator() { // Check for Null Reference if (_communicator != null) { // Connect Communication Server _communicator.Connect(); IPersistRepository <object> persistRepository = ContextRegistry.GetContext()["PersistRepository"] as IPersistRepository <object>; PersistencePublisher.InitializeDisruptor(true, persistRepository); } }
public IList <GameInfo> GetGamesList() { if (!_comm.IsConnected) { _comm.Connect(); } var message = new Message <ListGamesPayload> { Type = Common.Consts.ListGamesRequest, SenderId = Common.Consts.UnregisteredPlayerId }; var msg_string = JsonConvert.SerializeObject(message); _comm.Send(msg_string); Task <string> task; try { task = Task.Run(() => _comm.Receive()); if (!task.Wait(_timeout)) { throw new TimeoutException($"Did not receive any message after {_timeout}ms"); } } catch (AggregateException e) { throw e.InnerException; } var result = task.Result; var json = JsonConvert.DeserializeObject <Message <ListGamesResponsePayload> >(result); var gamesDto = json.Payload.Games; var gamesList = AutoMapper.Mapper.Map <List <GameInfo> >(gamesDto); return(gamesList); }
public void Init() { _comm = CommunicatorFactory.Create(); _comm.OnMessageArrived += Notify; _comm.Connect(); }