Base solution for your next web application
Open Closed

AbpCommonHub: use OnlineClient.Properties to store QueryString values #9078


User avatar
0
fabiovalerio created

Hi guys, is there any built-in way (without make a custom Hub), to automatically store QueryString values inside OnlineClient.Properties?

Actually I'm working on a FrontEnd custom app, that use SignalR environment to get notified for a specic events. But I need to know some certain client's metadata, and I'd like to use OnlineClient builtin "Properties" property!


6 Answer(s)
  • User Avatar
    0
    fabiovalerio created

    no Ideas?

  • User Avatar
    0
    maliming created
    Support Team

    hi

    What is product framework type (.net framework or .net core)?

    You can override the CreateClientForCurrentConnection method to customize OnlineClient.

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/37a46288e96a12b5a5318b84fd7bd659b61dc7f4/src/Abp.AspNetCore.SignalR/AspNetCore/SignalR/Hubs/OnlineClientHubBase.cs#L59

    https://github.com/aspnetboilerplate/aspnetboilerplate/blob/e0ded5d8702f389aa1f5947d3446f16aec845287/src/Abp.Web.SignalR/Web/SignalR/Hubs/AbpCommonHub.cs#L84

  • User Avatar
    0
    fabiovalerio created

    Hi @mailming,

    I'm on .net core version.

    Thanks for your reply! What you suggest, is to make a custom Hub inherting OnlineClientHubBase! It is correct, but is what I don't like to do, because it constraints me to reference my own dll inside Web.Host project to map the custom hub.

    I'd like to maintain my customized logic inside a Plugin, and load it dynamically with ABP plugin system!

    My question was if there are any automatic ways to populate OnlineClient.Properties from Querystring!

    If not, I will open a feature request on GitHub, or better, make a PR with this implementation :D

  • User Avatar
    0
    maliming created
    Support Team

    We can consider adding an IOnlineClientProvider interface to create OnlineClient. Just like the IClientInfoProvider interface. https://github.com/aspnetboilerplate/aspnetboilerplate/blob/37a46288e96a12b5a5318b84fd7bd659b61dc7f4/src/Abp.AspNetCore.SignalR/AspNetCore/SignalR/Hubs/OnlineClientHubBase.cs#L71

    This way you can replace provider through dependency injection.

    You can open PR if you want.

  • User Avatar
    0
    fabiovalerio created

    I made a PR that implements a more simple way to accomplish thoose needs. Please take a look at https://github.com/aspnetboilerplate/aspnetboilerplate/pull/5613

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @fabiovalerio

    We can continue discussing this on the related PR.