How can I get Online users at server side, to send notifications only to Online users, using a background job?
Background job:
public async Task SendNotifications()
{
await _backgroundJobManager.EnqueueAsync<NotificationJob,
UserIdentifier>(new UserIdentifier(_session.TenantId, _session.UserId.Value), delay: TimeSpan.FromSeconds(3));
}
public override void Execute(UserIdentifier args)
{
var notifications = _userNotificationManager.GetUserNotifications(args);
Abp.Threading.AsyncHelper.RunSync(() => _realTimeNotifier.SendNotificationsAsync(notifications.ToArray()));
}
My Job is on a API where I don't have my session with user info, so I want to get all Online users to publish notifications only to them and after that call my job to notify them.
- Does Module Zero by default uses Redis ? As Alper said "No".
- I need to connect to SignalR on my API too ? Adding
app.MapSignalR();
to my WebApistartup
seems to work, but sometimes doesn't, I am missing something - How can I get Online users at web api (server side) ? An alternative I found was to get all subscriptions (
GetSubscriptionsAsync
) and there I have my userId to send the notifications. var onlineClients = _onlineClients.GetAllClients(); is returning null
Thanks