sta / sta/websocket-sharp

CloseEventArgs Reason text is not transferred correctly

Open
#360 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I implement the server and the client with WebSocketSharp v1.0.4.0

In the server i use this code to close a connection:

Sessions.CloseSession(ID, CloseStatusCode.ProtocolError, "Request is missing the Target");

In the client, i have this code:

    private void WsOnOnError(object sender, ErrorEventArgs errorEventArgs)
    {
        Console.WriteLine($"WsOnOnError {errorEventArgs.Message} {errorEventArgs.Exception}");
    }

    private void WsOnOnClose(object sender, CloseEventArgs closeEventArgs)
    {
        Console.WriteLine($"WsOnOnClose {closeEventArgs.Reason} {closeEventArgs.Code} {closeEventArgs.WasClean}");
    }

My output is:

WsOnOnClose h♥?♦_§?QS§?∟S§?↑T☺?♣R♥?%[¶?¶N 1002 True

The reason is showing corrupted text.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using Sessions.CloseSession with CloseStatusCode.ProtocolError and the client WsOnOnClose handler shown in the report. Trace how the close reason travels from the server to CloseEventArgs.Reason, and verify that the exact text "Request is missing the Target" is received instead of corrupted characters. Done means the reported reason is preserved while the close code remains 1002.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.