Exemple #1
0
        public static void SignOut()
        {
            RestApi.Logout();
            RestApi = null;

            Websocket.Close();
            Websocket = null;
        }
Exemple #2
0
        private static bool InitWebsocket(SecureRestApi.AccessCredentials accessCredentials)
        {
            const string URI = "wss://entice-web-staging.herokuapp.com/socket/websocket";

            var parameters = new List<KeyValuePair<string, string>>
                                {
                                        new KeyValuePair<string, string>("client_id", accessCredentials.ClientId),
                                        new KeyValuePair<string, string>("entity_token", accessCredentials.EntityToken),
                                        new KeyValuePair<string, string>("map", accessCredentials.Area.ToString()),
                                        new KeyValuePair<string, string>("vsn", "1.0.0")
                                };

            if (Websocket != null) Websocket.Close();
            Websocket = new EnticeWebsocket(FormUri(URI, parameters));
            Websocket.Open();
            while (Websocket.State == WebSocketState.Connecting) ;
            return Websocket.State == WebSocketState.Open;
        }