Example #1
0
 public Operator(string login, Balancer balancer)
 {
     this._balancer = balancer;
     this.Login     = login;
     this._messages = new List <string>();
     this.Connect();
 }
Example #2
0
        private ChatServerResponse?Authenticate(string login = "******")
        {
            var balancer = new Balancer("balancer-cloud.global.livetex");

            this._operator = new Operator(login, balancer);
            return(this._operator.Authenticate("159236"));
        }
Example #3
0
        public void GetChatServerEndpoint(string login)
        {
            // .Arrange
            var balancer = new Balancer("balancer-cloud.global.livetex");
            // .Act
            var endPointUrl = balancer.RequestChatServerEndpoint(login);

            // .Assert
            Assert.AreEqual(endPointUrl, "ws://action-1.unstable.livetex:19090");
        }
Example #4
0
        private WebSocket CreateSocket(Balancer balancer)
        {
            var chatServerEndPointUrl = balancer.RequestChatServerEndpoint(this.Login);
            var webSocket             = new WebSocket(chatServerEndPointUrl);

            webSocket.OnError   += this.OnError;
            webSocket.OnClose   += this.OnClose;
            webSocket.OnOpen    += this.OnOpen;
            webSocket.OnMessage += this.OnMessage;
            return(webSocket);
        }