Base solution for your next web application
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);
    });
}
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

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.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @razkhan78

    Did that work for you ?

    Thanks,

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

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

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)