{"id":23138360,"url":"https://github.com/encodeous/wstream","last_synced_at":"2025-08-17T11:33:06.732Z","repository":{"id":50756990,"uuid":"248076585","full_name":"encodeous/wstream","owner":"encodeous","description":"WStream provides a high-level interface for performant and simple binary streams over WebSocket","archived":false,"fork":false,"pushed_at":"2024-01-05T01:17:01.000Z","size":169,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-27T19:34:04.853Z","etag":null,"topics":["client","csharp","high-performance","server","stream","websocket","websocket-server","websockets"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/wstream/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/encodeous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-17T21:28:14.000Z","updated_at":"2024-02-11T19:06:48.000Z","dependencies_parsed_at":"2022-09-03T05:00:34.339Z","dependency_job_id":null,"html_url":"https://github.com/encodeous/wstream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encodeous%2Fwstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encodeous%2Fwstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encodeous%2Fwstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/encodeous%2Fwstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/encodeous","download_url":"https://codeload.github.com/encodeous/wstream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230088603,"owners_count":18171135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","csharp","high-performance","server","stream","websocket","websocket-server","websockets"],"created_at":"2024-12-17T13:10:43.531Z","updated_at":"2024-12-17T13:10:43.620Z","avatar_url":"https://github.com/encodeous.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WStream - WebSocket Streams\n\n[![Download on Nuget](https://img.shields.io/nuget/v/wstream?style=flat-square)](https://www.nuget.org/packages/wstream/)\n\nWStream offers a simple and high-performance WebSocket stream built on top of Kestrel. It targets .NET Standard 2.0, as well as .NET Core 3.1 and above.\n\n## Use Cases:\n\n- Server-to-Server communication.\n- Sending binary data through web proxies like Cloudflare.\n- Building custom protocols.\n- Writing micro websocket servers without boilerplate.\n\n*Wow, that sounds great! How do I use WStream?*\n\n## Usage\n\nWStream offers three main constructs, `WsClient`, `WsServer` and `WsStream`.\n\n### Note\nFor versions of .NET Core 3.1 and above, the ASP.NET Core runtime has to be installed.\n\nHere is a simple example of a ping program built in WStream.\n\n```c#\n// create the server\nvar server = new WsServer();\nawait server.StartAsync(new IPEndPoint(IPAddress.Any, 8080), async stream =\u003e\n{\n    // called when a client connects\n    await stream.WriteAsync(BitConverter.GetBytes(DateTime.Now.ToBinary()));\n    await stream.CloseAsync();\n});\n\n// start client\nvar client = new WsClient();\nvar connection = await client.ConnectAsync(new Uri(\"ws://localhost:8080\"));\n// read data\nvar binReader = new BinaryReader(connection);\nConsole.WriteLine($\"Current time is {DateTime.FromBinary(binReader.ReadInt64())}\");\n\n// cleanup\nclient.Dispose();\nserver.Dispose();\n```\n\n## Performance\n\nAll benchmarks (prior to .NET 8) are run on a Windows 10 machine with an Intel i7-6700K CPU and 32GB of RAM, running on `Release`. Each test sends 5 gigabytes of data over the loopback connection.\n\nThe .NET 8 benchmarks are run on a Windows 11 machine with an Ryzen 9 7900x CPU with 64GB of RAM. (Thus the results cannot be compared across the two tables)\n\nThe results vary depending on the version of .NET used. Here are the results of the benchmarks, sorted in descending throughput:\n\n| .NET Version | Packet Size | Packets Per Second | Throughput |\n| ------------ | ------------ | ------------------ | ---------- |\n| .NET 8.0.0 | 262,144 | 6,192.41 msg/s | 1,623.26 MB/s |\n| .NET 8.0.0 | 65,536 | 23,675.68 msg/s | 1,551.61 MB/s |\n| .NET 8.0.0 | 131,072 | 9,302.29 msg/s | 1,219.27 MB/s |\n| .NET 8.0.0 | 8,192 | 82,673.11 msg/s | 677.26 MB/s |\n\n| .NET Version | Packet Size | Packets Per Second | Throughput |\n| ------------ | ------------ | ------------------ | ---------- |\n| .NET 6.0.0-rtm.21522.10 | 131,072 | 6,389.41 msg/s | 837.47 MB/s |\n| .NET 5.0.11 | 65,536 | 12,769.34 msg/s | 836.85 MB/s |\n| .NET Core 3.1.21 | 65,536 | 12,328.76 msg/s | 807.98 MB/s |\n| .NET 6.0.0-rtm.21522.10 | 65,536 | 12,270.52 msg/s | 804.16 MB/s |\n| .NET 5.0.11 | 131,072 | 6,021.29 msg/s | 789.22 MB/s |\n| .NET Core 3.1.21 | 131,072 | 6,051.64 msg/s | 793.20 MB/s |\n| .NET Core 3.1.21 | 262,144 | 2,944.58 msg/s | 771.88 MB/s |\n| .NET 5.0.11 | 262,144 | 2,905.69 msg/s | 761.69 MB/s |\n| .NET 6.0.0-rtm.21522.10 | 262,144 | 2,841.93 msg/s | 744.97 MB/s |\n| .NET 6.0.0-rtm.21522.10 | 8,192 | 78,116.06 msg/s | 639.93 MB/s |\n| .NET 5.0.11 | 8,192 | 71,034.53 msg/s | 581.91 MB/s |\n| .NET Core 3.1.21 | 8,192 | 62,709.79 msg/s | 513.72 MB/s |\n| .NET Framework 4.8.4420.0 | 131,072 | 1,094.11 msg/s | 143.41 MB/s |\n| .NET Framework 4.8.4420.0 | 262,144 | 527.24 msg/s | 138.21 MB/s |\n| .NET Framework 4.8.4420.0 | 65,536 | 2,097.67 msg/s | 137.47 MB/s |\n| .NET Framework 4.8.4420.0 | 8,192 | 14,423.41 msg/s | 118.16 MB/s |\n\n\n\n*Results may fluctuate based on CPU Usage, GC, and other variables. These numbers are based on a single run.*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fencodeous%2Fwstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fencodeous%2Fwstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fencodeous%2Fwstream/lists"}