Example #1
0
        //private string AuthData { get; set; }
        //private IAuthenticator Authenticator { get; }


        public ClientContext(HARRR hub, HubCallerContext hubCallerContext)
        {
            Id = hubCallerContext.ConnectionId;
            //ServiceProvider = serviceProvider;
            ServiceProvider = hubCallerContext.GetHttpContext().RequestServices;
            User            = hubCallerContext.User;
            HARRRType       = hub.GetType();

            RemoteIp = hubCallerContext.GetHttpContext().Connection.RemoteIpAddress;
            var connectedToBuilder = new UriBuilder(hubCallerContext.GetHttpContext().Request.GetDisplayUrl());

            connectedToBuilder.Query = null;
            ConnectedTo = connectedToBuilder.Uri;

            foreach (var(key, value) in hubCallerContext.GetHttpContext().Request.Headers)
            {
                if (key.StartsWith("#"))
                {
                    Attributes[key.Substring(1)] = value;
                }
            }

            foreach (var(key, value) in hubCallerContext.GetHttpContext().Request.Query)
            {
                if (key.StartsWith("@"))
                {
                    Attributes[key.Substring(1)] = value;
                }
            }
        }
Example #2
0
 public MessageHandler(HARRR harrr, ClientContext clientContext, ISignalARRRMethodsCollection methodsCollection, IServiceProvider serviceProvider, ISignalARRRInterfaceCollection signalARRRInterfaceCollection)
 {
     HARRR               = harrr;
     MethodsCollection   = methodsCollection;
     InterfaceCollection = signalARRRInterfaceCollection;
     ClientContext       = clientContext;
     _serviceProvider    = serviceProvider;
     Logger              = _serviceProvider.GetService <ILoggerFactory>()?.CreateLogger(GetType().FullName) ?? NullLogger.Instance;
 }
 public ClientContext Register(HARRR huc, HubCallerContext hubContext)
 {
     return(ClientStore.AddOrUpdate(hubContext.ConnectionId, id => {
         return new ClientContext(huc, hubContext)
         {
             ConnectedAt = DateTime.UtcNow
         };
     }, (s, cl) => {
         cl.ReconnectedAt.Add(DateTime.UtcNow);
         return cl;
     }));
 }