Ejemplo n.º 1
0
 protected override Task OnDisconnected(IRequest request, string connectionId)
 {
     string name = _clients[connectionId];
     ChatData chatData = new ChatData("Server", string.Format("{0} has left the room.", name));
     _clients.Remove(connectionId);
     return Connection.Broadcast(chatData);
 }
Ejemplo n.º 2
0
        protected override Task OnReceived(IRequest request, string connectionId, string data)
        {
            ChatData chatData = JsonConvert.DeserializeObject <ChatData>(data);

            _clients[connectionId] = chatData.Name;
            return(Connection.Broadcast(chatData));
        }
Ejemplo n.º 3
0
        protected override Task OnConnected(IRequest request, string connectionId)
        {
            _clients.Add(connectionId, string.Empty);
            ChatData chatData = new ChatData("Server", "A new user has joined the room.");

            return(Connection.Broadcast(chatData));
        }
Ejemplo n.º 4
0
        protected override Task OnDisconnected(IRequest request, string connectionId)
        {
            string   name     = _clients[connectionId];
            ChatData chatData = new ChatData("Server", string.Format("{0} has left the room.", name));

            _clients.Remove(connectionId);
            return(Connection.Broadcast(chatData));
        }
Ejemplo n.º 5
0
 public ActionResult ChatR()
 {
     var vm = new ChatData();
     return View(vm);
 }
Ejemplo n.º 6
0
 protected override Task OnConnected(IRequest request, string connectionId)
 {
     _clients.Add(connectionId, string.Empty);
     ChatData chatData = new ChatData("Server", "A new user has joined the room.");
     return Connection.Broadcast(chatData);
 }