Exemplo n.º 1
0
        public ITransportConnection OpenConnection(string host, int port, Context context, Action <Connection> onConnected)
        {
            if (port == -1 || host == null)
            {
                throw new Error(ErrorCode.CONNECTION_ERROR, "No port and/or IP address is present in configuration.");
            }

            ITransportConnection transportConnection = webSocketFactory.Construct("ws://" + host + ":" + port + "/");

            transportConnection.Error += (sender, e) => {
                logger.Warn("Error in connection to " + host + ":" + port, e.Exception);
            };
            transportConnection.Open();
            return(transportConnection);
        }