We need to use default AbpCommonHub for sending some signalR messages. We are able to inject it in controller and also user is connected to it but when we send message from it _hubContextAbpCommon.Clients.User(userId.ToString()).SendAsync("test", "test"); message is not received on client side, where we have registered callback also as below in abp.signalr-client.js:
// Configure the connection function configureConnection(connection) { // Set the common hub abp.signalr.hubs.common = connection;
// Reconnect if hub disconnects
connection.onclose(function (e) {
if (e) {
abp.log.debug('Connection closed with error: ' + e);
}
else {
abp.log.debug('Disconnected');
}
if (!abp.signalr.autoConnect) {
return;
}
setTimeout(function () {
connection.start();
}, 5000);
});
// Register to get notifications
connection.on('getNotification', function (notification) {
abp.event.trigger('abp.notifications.received', notification);
});
connection.on('test', function (notification) {
alert(notification);
});
}
3 Answer(s)
-
0
@razkhan78, take a look here: Simple SignalR implementation. It may help, I had a similar problem and the solution is in my last post.
-
0
Hi @razkhan78
Did that work for you ?
Thanks,
-
0
This issue is closed because it has not had recent activity for a long time.