Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Use default AbpCommonHub for sending some signalR messages #7744


User avatar
0
razkhan78 created

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)
  • User Avatar
    0
    BobIngham created

    @razkhan78, take a look here: Simple SignalR implementation. It may help, I had a similar problem and the solution is in my last post.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @razkhan78

    Did that work for you ?

    Thanks,

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.