Exemple #1
0
        public async Task <IActionResult> ChatAsync(string channelName, ChatRequest request)
        {
            await _webSocketIo.Broadcast.In(channelName).SendDataAsync(
                WebSocketIoResponse.CreateEvent(_packet, "chat.received", request.Message));

            return(Ok());
        }
Exemple #2
0
        public async Task <IActionResult> JoinAsync(string channelName)
        {
            _webSocketIo.Disconnecting += WebSocketIoOnDisconnecting;
            _webSocketIo.Leaved        += WebSocketIoOnLeaved;

            await _webSocketIo.JoinAsync(channelName);

            await _webSocketIo.Broadcast.In(channelName).SendDataAsync(
                WebSocketIoResponse.CreateEvent(_packet, "chat.joined", $"Joined {_webSocketIo.SocketId} in {channelName}."));

            return(Ok());
        }