Exemple #1
0
        public async Task Disconnect()
        {
            this.token = null;
            this.cancellationTokenSource.Cancel();
            if (this.socket != null)
            {
                await this.socket.Disconnect();

                this.socket = null;
            }
        }
        private async Task InitializeInternal()
        {
            this.ChannelInfo = await this.GetChannelInformation();

            foreach (GameWispSubscriber subscriber in await this.GetCachedSubscribers())
            {
                UserDataViewModel userData = ChannelSession.Settings.UserData.Values.FirstOrDefault(u => u.UserName.Equals(subscriber.UserName, StringComparison.CurrentCultureIgnoreCase));
                if (userData != null)
                {
                    userData.GameWispUserID = subscriber.UserID;
                }
            }

            this.socket = new GameWispWebSocketService(this, await this.GetOAuthToken());
            await this.socket.Connect();
        }