sta / sta/websocket-sharp

Get a list of connected clients in a server

Open
#331 1 comment 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

Hi,
I have a WebSocketServer with a certain WebSocketBehaviour. "OnOpen" and "OnMessage" are triggered when a client connects and a message is received.
Now I want to maintain a list of connected clients (for displaying in a GUI a.s.o.). What is the recommended way of getting hold of such a list?
Of course I could get all services via WebSocketServices.Hosts and walk through the Sessions of service.Sessions (actually ServiceManager - maybe it should be renamed?). But I would need to poll periodically to update my list.
Or is there a better way to send the OnOpen/OnClose events from the behaviour to the "main thread" (which creates the WebSocketServer).
Thanks! Great working library, btw!

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 WebSocketServer, WebSocketBehaviour, WebSocketServices.Hosts, service.Sessions, and the OnOpen/OnClose events mentioned in the issue. Trace how sessions and behaviour events are exposed, then determine the supported approach for observing connected clients without polling. Done means the recommended API or event-based workflow is clear and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.