Example #1
0
        private static void LogReceived(IChannelHubClient hubClient, IDictionary <string, object> logRecord)
        {
            var machineName  = logRecord["MachineName"];
            var processId    = logRecord["ProcessId"];
            var connectionId = logRecord["ConnectionId"];
            var virtAddress  = logRecord["VirtAddress"];
            var logLevel     = logRecord["LogLevel"];
            var text         = logRecord["Text"];

            Console.WriteLine($"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}] [{machineName}] [{processId}] [{connectionId}] [{virtAddress}] [{logLevel}]");
            Console.WriteLine($"{text}");
        }
        private bool _disposed = false;         // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.
                this.Client = null;

                _disposed = true;
            }
        }
Example #3
0
 public SignalRHubChannel(ChannelInfo channelInfo)
 {
     _channelInfo = channelInfo;
     _hub         = new ChannelHubClient(channelInfo.SID);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="connectionId"></param>
 /// <param name="client"></param>
 public HubConnection(string connectionId, IChannelHubClient client)
 {
     this.ConnectionId = connectionId ?? throw new ArgumentNullException(nameof(connectionId));
     this.Client       = client ?? throw new ArgumentNullException(nameof(client));
 }
Example #5
0
 private static Task Disconnected(IChannelHubClient hubClient, Exception error)
 {
     Console.WriteLine("Disconnected");
     return(Task.CompletedTask);
 }
Example #6
0
 private static void Connected(IChannelHubClient hubClient)
 {
     Console.WriteLine("Connected");
 }
Example #7
0
 private static void MessagesReceived(IChannelHubClient hubClient, Message[] messages)
 {
     _count++;
     Console.WriteLine($"{_count}. Messages: {messages.Length}");
 }