c# - Wpf client and asp.net web app signalr Hub , save users logged in from wpf client in signalr server -
i creating signalr hub in asp.net web app. wpf application client signalr hub
i have login facility in wpf application , want store users on hub created in asp.net , can send information specific user. want store 2 properties username , usertoken , list of these properties in hub , how can send properties information hub
i tried using client.caller not getting value in connected or disconnected event on hub
you can access user in hub methods: there user
instance property. token, assume in request headers. can access in hub context.request.headers
property. don't need store users send data them. somewhere (not in hub inheritor) have line this:
private static readonly lazy<ihubcontext> _hubctx = new lazy<ihubcontext>(() => globalhost.connectionmanager.gethubcontext<myhub>()); protected virtual task sendreporttoall(report r) { return _hubctx.value.clients.all.eventtotriggeronclient(r); } protected virtual task sendreporttouser(report r, string username) { return _hubctx.value.clients.user(username).eventtotriggeronclient(r); }
Comments
Post a Comment