Exemplo n.º 1
0
        public HubProxy(string endpoint, string accessKey, string hubName, HubProxyOptions options)
        {
            if (string.IsNullOrEmpty(endpoint))
            {
                throw new ArgumentNullException(nameof(endpoint));
            }

            if (string.IsNullOrEmpty(accessKey))
            {
                throw new ArgumentNullException(nameof(accessKey));
            }

            if (string.IsNullOrEmpty(hubName))
            {
                throw new ArgumentNullException(nameof(hubName));
            }

            Clients = new HubClientsProxy(endpoint, accessKey, hubName, options);
            Groups  = new GroupManagerProxy(endpoint, accessKey, hubName, options);

            HubName = hubName.ToLower();
        }
Exemplo n.º 2
0
        public GroupManagerProxy(string endpoint, string accessKey, string hubName, HubProxyOptions options)
        {
            if (string.IsNullOrEmpty(endpoint))
            {
                throw new ArgumentNullException(nameof(endpoint));
            }

            if (string.IsNullOrEmpty(accessKey))
            {
                throw new ArgumentNullException(nameof(accessKey));
            }

            if (string.IsNullOrEmpty(hubName))
            {
                throw new ArgumentNullException(nameof(hubName));
            }

            var apiVersion = options?.ApiVersion ?? HubProxyOptions.DefaultApiVersion;

            _baseUri   = $"{endpoint}:{ProxyPort}/{apiVersion}/hub/{hubName.ToLower()}/group";
            _accessKey = accessKey;
        }
Exemplo n.º 3
0
        public HubClientsProxy(string endpoint, string accessKey, string hubName, HubProxyOptions options)
        {
            if (string.IsNullOrEmpty(endpoint))
            {
                throw new ArgumentNullException(nameof(endpoint));
            }

            if (string.IsNullOrEmpty(accessKey))
            {
                throw new ArgumentNullException(nameof(accessKey));
            }

            if (string.IsNullOrEmpty(hubName))
            {
                throw new ArgumentNullException(nameof(hubName));
            }

            _endpoint  = endpoint;
            _accessKey = accessKey;
            _hubName   = hubName.ToLower();
            _options   = options ?? HubProxyOptions.DefaultHubProxyOptions;

            All = ClientProxyFactory.CreateAllClientsProxy(_endpoint, _options.ApiVersion, _accessKey, _hubName);
        }
Exemplo n.º 4
0
        public static HubProxy CreateHubProxyFromConnectionString(string connectionString, string hubName, HubProxyOptions options)
        {
            var connStr = ParseConnectionString(connectionString);

            return(new HubProxy(connStr.Endpoint, connStr.AccessKey, hubName));
        }
Exemplo n.º 5
0
 public static HubProxy CreateHubProxyFromConnectionString <THub>(string connectionString, HubProxyOptions options)
     where THub : Hub
 {
     return(CreateHubProxyFromConnectionString(connectionString, typeof(THub).Name, options));
 }