Example #1
0
        private static async Task Main(string[] args)
        {
            ILoggerFactory loggerFactory = LoggerFactoryExtensions.CreateDefault();

            var config = await JsonExtensions
                         .ReadJsonAsync <ServerConfiguration>("appconfig.json");

            var factory = new ServerWebSocketFactory(
                loggerFactory.CreateLogger <ServerWebSocket>(),
                config.Host,
                config.Port);
            IConnection connection = factory.Create();

            var server = new Server(
                loggerFactory.CreateLogger <Server>(),
                connection,
                config);

            server.Start();

            await Task.Delay(-1);
        }
Example #2
0
        private static async Task Main(string[] args)
        {
            ILoggerFactory loggerFactory = LoggerFactoryExtensions.CreateDefault();

            var config = await JsonExtensions
                         .ReadJsonAsync <ClientConfiguration>("appconfig.json");

            var factory = new ClientWebSocketFactory(
                loggerFactory.CreateLogger <ClientWebSocket>(),
                config.Host,
                config.Port,
                config.ReconnectionTimeout);
            IConnection connection = factory.Create();

            var client = new Client(
                loggerFactory.CreateLogger <Client>(),
                connection,
                config);

            client.Start();

            await Task.Delay(-1);
        }