示例#1
0
文件: Client.cs 项目: jaras/OCTGN
 public Client(IClientConfig config, Version octgnVersion)
 {
     _config = config;
     _clientAuthenticator = new ClientAuthenticator();
     _client = new Octgn.Communication.Client(_config.CreateConnection(_config.ChatHost), new Octgn.Communication.Serializers.XmlSerializer(), _clientAuthenticator);
     _client.InitializeSubscriptionModule();
     _client.InitializeHosting(octgnVersion);
 }
        public async Task <AuthenticationResult> Authenticate(Octgn.Communication.Client client, IConnection connection, CancellationToken cancellationToken)
        {
            var req = new Octgn.Communication.Packets.AuthenticationRequestPacket("session");

            req["sessionKey"] = SessionKey;
            req["userId"]     = UserId;
            req["deviceId"]   = DeviceId;

            var result = await client.Request(req, cancellationToken);

            return(result.As <AuthenticationResult>());
        }