public override async Task ReceiveAsync(WebSocket socket, WebSocketReceiveResult result, byte[] buffer)
        {
            var socketId = WebSocketObjectHolder.GetId(socket);
            var message  = $"{socketId} said: {Encoding.UTF8.GetString(buffer, 0, result.Count)}";

            await SendMessageToAllAsync(message);
        }
        public override async Task OnDisconnected(WebSocket socket)
        {
            var socketId = WebSocketObjectHolder.GetId(socket);

            await base.OnDisconnected(socket);

            await SendMessageToAllAsync($"{socketId} disconnected");
        }
Example #3
0
        public override async Task OnConnected(WebSocket socket)
        {
            await base.OnConnected(socket);

            var socketid = WebSocketObjectHolder.GetId(socket);

            await SendMessageToAllAsync($"{socketid} is now connected");
        }
 public TestMessageHandler(WebSocketObjectHolder webSocketObjectHolder) : base(webSocketObjectHolder)
 {
 }
 public WebSocketHandler(WebSocketObjectHolder webSocketObjectHolder)
 {
     WebSocketObjectHolder = webSocketObjectHolder;
 }