public override async Task ReceiveAsync(WebSocket socket, WebSocketReceiveResult result, byte[] buffer) { var socketId = WebSocketConnectionManager.GetId(socket); var message = $"{socketId} said: {Encoding.UTF8.GetString(buffer, 0, result.Count)}"; await SendMessageToAllAsync(message); }
public override async Task OnConnected(WebSocket socket) { await base.OnConnected(socket); var socketId = WebSocketConnectionManager.GetId(socket); await SendMessageToAllAsync($"{socketId} is now connected"); }