Exemplo n.º 1
0
        public async Task <IActionResult> JoinGroup(string connectionId)
        {
            var setting = await _branchSettingService.GetBranchSetting(UserBranchId);

            // consider branchId  a group name , so all branch member automate be in a group
            await _advancedHub.Groups.AddToGroupAsync(connectionId, UserBranchIdString);

            await _advancedHub.Clients.User(User.FindFirst(ClaimTypes.NameIdentifier)?.Value).SendAsync($"branchSettings-{UserBranchIdString}", setting);

            return(Ok());
        }
Exemplo n.º 2
0
        public IActionResult Get()   // client push a request to start a room/channel/connection
        {
            // synchronized function
            var setting = _branchSettingService.GetBranchSetting(UserBranchId);

            _advancedHub.Clients.Group(UserBranchIdString).SendAsync($"branchSettings-{UserBranchIdString}", setting);

            return(Ok(new { message = "message have been sent" }));
        }