Exemplo n.º 1
0
        public override async Task OnConnectedAsync()
        {
            var roomId = await _chatRoomService.CreateRoom(Context.ConnectionId);

            await Groups.AddToGroupAsync(Context.ConnectionId, roomId.ToString());


            await Clients.Caller.SendAsync("ReceiveMessage", "Tayyab Bhatti", DateTimeOffset.UtcNow, "Hello! what can I help You");

            await base.OnConnectedAsync();
        }
Exemplo n.º 2
0
        public override async Task OnConnectedAsync()
        {
            var roomId = await _chatRoomService.CreateRoom(Context.ConnectionId);

            await Groups.AddToGroupAsync(Context.ConnectionId, roomId.ToString());

            await Clients.Caller.SendAsync("ReceiveMessage"
                                           , "Explore California"
                                           , DateTimeOffset.UtcNow
                                           , "Hello! Waht can we help you?");

            await base.OnConnectedAsync();
        }
Exemplo n.º 3
0
        public override async Task OnConnectedAsync()
        {
            var roomId = await _chatRoomService.CreateRoom(Context.ConnectionId);

            await Groups.AddToGroupAsync(Context.ConnectionId, roomId.ToString());

            await Clients.Caller.SendAsync("ReciveMessage",
                                           "TopLearn Support",
                                           DateTimeOffset.UtcNow,
                                           "Hello ! What can we help you with today ?");

            await base.OnConnectedAsync();
        }
Exemplo n.º 4
0
        public override async Task OnConnectedAsync()
        {
            var roomId = await _chatRoomService.CreateRoom(Context.ConnectionId);

            await Groups.AddToGroupAsync(
                Context.ConnectionId, roomId.ToString());

            await Clients.Caller.SendAsync(
                "ReceiveMessage",
                "WebSignalR",
                DateTimeOffset.UtcNow,
                "Pozdrav...");

            await base.OnConnectedAsync();
        }
Exemplo n.º 5
0
        public async Task <IActionResult> CreateRoom(ChatRoomCreateViewModel roomVM)
        {
            var room = new ChatRoom {
                Name    = roomVM.Name,
                OwnerID = HttpContext.GetUserID()
            };

            if (!string.IsNullOrEmpty(roomVM.Password))
            {
                room.Password = BCrypt.Net.BCrypt.HashPassword(roomVM.Password, BCrypt.Net.BCrypt.GenerateSalt());
            }
            var id = await _roomService.CreateRoom(room);

            return(RedirectToAction("Room", new { roomId = id }));
        }
Exemplo n.º 6
0
        public override async Task OnConnectedAsync()
        {
            if (Context.User.Identity.IsAuthenticated)
            {
                // Authenticated agents don't need a room
                await base.OnConnectedAsync();

                return;
            }

            var roomId = await _chatRoomService.CreateRoom(
                Context.ConnectionId);

            await Groups.AddToGroupAsync(
                Context.ConnectionId, roomId.ToString());

            await Clients.Caller.SendAsync(
                "ReceiveMessage",
                "Explore California",
                DateTimeOffset.UtcNow,
                "Hello! What can we help you with today?");

            await base.OnConnectedAsync();
        }
Exemplo n.º 7
0
        public async Task <IActionResult> SaveChatRoom(CreateRoomDto chatRoom)
        {
            await _chatRoomService.CreateRoom(chatRoom);

            return(StatusCode(201));
        }