WebSocket4Net will not connect

Jun 21 at 6:16 PM
I have a client app using WebSocket4Net and a server app running SuperSocket. The server is receiving the connction request but the client is state is stuck in Connecting. It doesnt recive any conncetions from the server unless I close the server and then it registers the closed event. Is there anything obvious I am missing ? thanks in advance for any help.

Here is the code, First a management class:-

class DataManager { #region Singleton
public static DataManager myInstance;

public static DataManager GetInstance()
{
    if (myInstance == null)
    {
        myInstance = new DataManager();
    }

    return myInstance;
}

private DataManager()
{ }

#endregion




string ip = "ws://127.0.0.1:57000";
public WebSocket websocket;

public void openConnection()
{
    websocket = new WebSocket(ip);

    websocket.Opened += new EventHandler(websocket_Opened);
    websocket.Error += new EventHandler<ErrorEventArgs>(websocket_Error);
    websocket.Closed += new EventHandler(websocket_Closed);
    websocket.MessageReceived += new EventHandler<WebSocket4Net.MessageReceivedEventArgs>(websocket_MessageReceived);
    websocket.DataReceived += new EventHandler<DataReceivedEventArgs>(websocket_MessageReceived);

    websocket.Open();

}


private void websocket_MessageReceived(object sender, EventArgs e)
{

    int x = 1;
    throw new NotImplementedException();

}

private void websocket_Closed(object sender, EventArgs e)
{

    throw new NotImplementedException();
}

private void websocket_Error(object sender, ErrorEventArgs e)
{
    throw new NotImplementedException();
}

private void websocket_Opened(object sender, EventArgs e)
{
    //TODO logic for socket opened
    int x = 1;
}
}
Client:

public MainWindow()
    {
        InitializeComponent();
        Task socket = Task.Run(() => DataManager.GetInstance().openConnection());
        // socket.Start();

        while (true)
        {
            System.Threading.Thread.Sleep(500);
            string connection = DataManager.GetInstance().websocket.State.ToString();
        }

    }
And the server:

public void startSocket()
    {


        var appServer = new AppServer();

        // setup the port
        if (!appServer.Setup(57000))
        {
            // TODO add to loggin
        }

        // start the server
        if (!appServer.Start())
        {
            // TODO add to loggin
        }

        appServer.NewSessionConnected += new SessionHandler<AppSession>(socket_NewSessionConnection);

        appServer.NewRequestReceived += new RequestHandler<AppSession, SuperSocket.SocketBase.Protocol.StringRequestInfo>(onData);


    }

    private void onData(AppSession session, StringRequestInfo requestInfo)
    {
        //logic for income data 
        int x = 1;

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="session"></param>
    private void socket_NewSessionConnection(AppSession session)
    {
        // implement logic for checking username and password
        int x = 1;


            Thread.Sleep(1000);
            session.Send("success");
            if (session.TrySend("test"))
            {
                x = 1;
            }



        session.Send("success");
        if (session.TrySend("sasasasasa"))
        {
            x = 1;
        }  
    }