sta / sta/websocket-sharp

WebSocketSharp only allowing one packet per second.

Open
#303 0 comments 0 reactions 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

So I wrote a C# server and a websocket client in javascript but when sending more than 2 messages per second it only sends one of them, heres my server code.

        JArray a = JArray.Parse(e.Data);

        foreach (var item in a.Children())
        {
            var itemProperties = item.Children<JProperty>();
            switch (itemProperties.FirstOrDefault(x => x.Name == "m").Value.ToString())
            {
                case "hi":
                    Send("[{\"m\": \"hi\", \"u\": {\"_id\": \"000\", \"name\": \"Test\", \"color\": \"#000\"}, \"t\": " + (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + "}]");
                    break;
                case "n":
                    Sessions.Broadcast("[{\"m\": \"n\", \"t\": " + (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + ", \"n\": " + itemProperties.FirstOrDefault(x => x.Name == "n").Value.ToString() + ", \"p\": \"000\"}]");
                    break;
                case "t":
                    Send("[{\"m\": \"t\", \"t\": " + (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds +  ", \"e\": " + itemProperties.FirstOrDefault(x => x.Name == "e").Value.ToString() + "}]");
                    break;
            }
        }

`

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

Start with the posted C# server handler and trace the Send and Sessions.Broadcast calls in the repository. Reproduce the report with more than two messages per second, then inspect the relevant WebSocket send and receive paths; done means the messages are delivered without the reported rate limit.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.