Skip to content

wss issue "The client and server cannot communicate, because they do not possess a common algorithm" #177

Description

@Sergio1C

Hi.
I trying to use this package but getting output message as shown on titile

`
/// Using a test's web socket echo server at: https://www.websocket.org/echo.html
[TestClass]
public class WebSocket4Net_UnitTest
{
private readonly string webSocketHost = "wss://echo.websocket.org/";
private readonly string echoCommand = "Hi, Kaazing! How are you?";

    private WebSocket websocket;

    [TestMethod]
    public void TestConnection_WhenPutCommandFirst_ExpectedCorrectResult()
    {
        //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

        websocket = new WebSocket(uri: webSocketHost);
        websocket.Opened += new EventHandler(websocket_Opened);
        websocket.Error += new EventHandler<SuperSocket.ClientEngine.ErrorEventArgs>(websocket_Error);
        websocket.Closed += new EventHandler(websocket_Closed);
        websocket.MessageReceived += new EventHandler<MessageReceivedEventArgs>(websocket_MessageReceived);
        websocket.Open();

        while (websocket.State == WebSocketState.Connecting)
        {
            Thread.Sleep(500);
        }
    }

    void websocket_Opened(object sender, EventArgs e)
    {
        Debug.WriteLine($"Websocket opened");
        this.websocket.Send($"{echoCommand}");

    }

    void websocket_MessageReceived(object sender, MessageReceivedEventArgs e)
    {
        Debug.WriteLine($"Message received: {e.Message}");
    }

    void websocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
    {
        Debug.WriteLine($"Error: {e.Exception.Message}");
    }

    private void websocket_Closed(object sender, EventArgs e)
    {
        Debug.WriteLine($"Websocket closed: {e}");
    }
}`

After some googling i found a possible solution but it isn't helped me.
I have tried to change target .Net framework for 4.6.2 also but got the same.

If to try with ws uri (webSocketHost = "ws://echo.websocket.org/") it will work. . I'm assumpting it may be related with some of TLS issue? Can you help.

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions