sta / sta/websocket-sharp

Socket OnClose received before completing further messages in OnMessage

Open
#641 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

#Scenario1 :
Request to close the connection & server sends the ACK & connection close(only 2 responses). OnMessage it receives those 2 responses properly then OnClose listener get the intimation of connection closed.

#Scenario2 :
Request to close the connection & server sends few more messages on last it also sends and ACK & Close connection(total of 10 responses). In that time,
OnMessage receiving the messages & handling it. While receiving it OnClose and triggered. So, last few messages which are supposed to receive got cancelled and not received on the client end, due to socket connection got closed.

My question is that, It is supposed received all the messages and then on Queue it should trigger OnClose in the socket which is listening in the client side. But, due to the slow internet it takes time to receive the packets which are supposed to receive before connection got closed.

How it should be handled? Any suggestion or work around to handle this case?

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

No files, tests, or entry points are named. Start by reproducing Scenario 2 and reviewing the WebSocket message and close-event ordering described in the issue; done requires an agreed behavior and a focused resolution for messages sent before connection closure.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.