Exemplo n.º 1
0
        public override Task OnDisconnected(bool stopCalled)
        {
            DirectMessageService _DirectMessageService = new DirectMessageService();

            _DirectMessageService.DeleteUserConnectionIds(Context.ConnectionId);
            return(base.OnDisconnected(stopCalled));
        }
Exemplo n.º 2
0
 public DirectMessageController(AccountService accountService,
                                DirectMessageService directMessageService,
                                IHubContext <DirectMessageHub> hubContext) : base(accountService)
 {
     _directMessageService = directMessageService;
     _hubContext           = hubContext;
 }
Exemplo n.º 3
0
        public override Task OnReconnected()
        {
            DirectMessageService _DirectMessageService = new DirectMessageService();

            _DirectMessageService.DeleteUserConnectionIds(savedConnectionId);
            _DirectMessageService.StoreUserConnectionIds(savedUserId, Context.ConnectionId);
            return(base.OnReconnected());
        }
Exemplo n.º 4
0
        public async Task refreshMessages(List <string> userIds, SendTextViewModel message, string userId)
        {
            DirectMessageService _DirectMessageService = new DirectMessageService();
            var connectionIds = _DirectMessageService.GetUserConnectionIds(userIds);

            foreach (var connections in connectionIds)
            {
                foreach (var userConnections in connections)
                {
                    await Clients.Client(userConnections.connection_id).SendAsync(message, userId);
                }
            }
        }
Exemplo n.º 5
0
        public async Task saveFunction(string id)
        {
            DirectMessageService _DirectMessageService = new DirectMessageService();

            _DirectMessageService.StoreUserConnectionIds(id, Context.ConnectionId);
        }