コード例 #1
0
        public async Task StartAsync()
        {
            // this makes it work with localhost tls only
            System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
            logger  = new WebSocketsConsoleLogger(true);
            manager = new WebSocketsManager(logger);
            manager.Initialize(GetType().Assembly, new object[] { this });
            client = new ClientWebSocket();
            client.Options.SetRequestHeader("x-api-key", "");
            await client.ConnectAsync(new Uri("ws://elixirmarketplace.xyz:5035/ws"), CancellationToken.None);

            // Tell which server has connected
            await manager.TellWebSocketAsync(client, "ServerId", null, 1);

            await manager.ListenWebSocketAsync(client);
        }
コード例 #2
0
 public WebSocketsManager(IWebSocketsLogger logger = null)
 {
     this.logger = logger;
 }