예제 #1
0
        /// <summary>Creates instanse of Flux SDK</summary>
        /// <param name="clientId">The client ID provided to you when you created your app.</param>
        /// <param name="clientVersion">Version of the your app (optional).</param>
        /// <param name="additionalClientData">HostProgramVersion and HostProgramMainFile are required.</param>
        /// <param name="fluxUrl">Use to override the base Flux URL, e.g., for testing purposes. (optional)</param>
        public FluxSDK(string clientId, string clientVersion = null, Dictionary <string, string> additionalClientData = null, Uri fluxUrl = null)
        {
            log.Info("Creating SDK instance. SDK version: {0}", Constants.ASSEMBLY_VERSION);

            if (string.IsNullOrEmpty(clientId))
            {
                log.Fatal("Unable to create Flux SDK. ClientId can't be null or empty");
                throw new Exceptions.InternalSDKException("ClientId can't be null or empty.");
            }

            log.Info("Getting Flux Server URL");
            Uri serverUri;

            if (fluxUrl == null)
            {
                serverUri = Utils.GetServerUri();
            }
            else
            {
                log.Info("Flux URL is set by constructor to {0}", fluxUrl);
                serverUri = fluxUrl;
            }

            log.Info("Initializing ClientInfo and PluginMetadata");
            sdkMetadata = new SDKMetadata(serverUri, new ClientInfo(clientId, clientVersion, additionalClientData));

            //try to init user from cookies
            InitUserFromCookies(clientId);
            log.Info("SDK instance successfully created.");
        }
예제 #2
0
        internal WebSocket(string projectId, List <FluxCookie> userCookies, SDKMetadata sdkMetadata)
        {
            log.Debug("WebSocket creation for the project {0}.", projectId);

            msgBuffer      = new List <string>();
            ProjectId      = projectId;
            webSocketState = FluxWebSocketStates.NotInitialized;

            this.userCookies = userCookies;
            this.sdkMetadata = sdkMetadata;

            //create and connect the websocket
            Reconnect();
        }