public void Start(IList <IWebSocketConnection> clients) { var loggerConfig = _loggerContext.LoggerConfig as ILoggerConfig; _server = _webSocketServerFactory.New(loggerConfig.ServerLoggingAddress); _server.Start(socket => { socket.OnOpen = () => { _writer.WriteLine("Logging Server OnOpen..."); clients.Add(socket); }; socket.OnClose = () => { _writer.WriteLine("Logging Server OnClose..."); clients.Remove(socket); }; socket.OnError = exception => { _writer.WriteLine($"Logging Server OnError, Error details:{exception.Message}"); }; var consumer = new SeriLogConsumer(_loggerContext); socket.StartConsuming(new AuditCommandConsumer(consumer, socket, _writer)); }); }
public void Start(IList <IWebSocketConnection> clients) { var loggerConfig = _loggerContext.LoggerConfig; _server = _webSocketServerFactory.New(loggerConfig.Endpoint); _server.Start(socket => { socket.OnOpen = () => { _writer.WriteLine("Logging Server OnOpen..."); clients.Add(socket); }; socket.OnClose = () => { _writer.WriteLine("Logging Server OnClose..."); clients.Remove(socket); }; socket.OnError = exception => { _writer.WriteLine($"Logging Server OnError, Error details:{exception.Message}"); }; var innerConsumer = new SeriLogConsumer(_loggerContext); var defaultConsumer = _auditCommandConsumerFactory?.New(innerConsumer, socket, _writer) ?? new AuditCommandConsumerFactory().New(innerConsumer, socket, _writer); socket.StartConsuming(new ForwardingConsumer(defaultConsumer, _loggerContext)); }); }