{"id":13824933,"url":"https://github.com/StackExchange/NetGain","last_synced_at":"2025-07-08T20:32:31.489Z","repository":{"id":30970084,"uuid":"34528276","full_name":"StackExchange/NetGain","owner":"StackExchange","description":"A high performance websocket server library powering Stack Overflow.","archived":true,"fork":false,"pushed_at":"2019-01-08T09:08:20.000Z","size":313,"stargazers_count":928,"open_issues_count":15,"forks_count":141,"subscribers_count":84,"default_branch":"master","last_synced_at":"2024-11-20T03:31:58.400Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"brandonstevens/sumologic-sdk-go","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StackExchange.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":"2015-04-24T16:05:02.000Z","updated_at":"2024-11-16T00:50:53.000Z","dependencies_parsed_at":"2022-08-23T12:01:47.639Z","dependency_job_id":null,"html_url":"https://github.com/StackExchange/NetGain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StackExchange/NetGain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2FNetGain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2FNetGain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2FNetGain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2FNetGain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StackExchange","download_url":"https://codeload.github.com/StackExchange/NetGain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2FNetGain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264343763,"owners_count":23593787,"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":[],"created_at":"2024-08-04T09:01:12.114Z","updated_at":"2025-07-08T20:32:31.055Z","avatar_url":"https://github.com/StackExchange.png","language":"C#","readme":"## Welcome to StackExchange.NetGain! ##\n\n# Warning: reduced maintenance\n\nA few things have changed since this library was written:\n\n- \"pipelines\" have become the new hotness for high performance low overhead IO code - [see my 3-and-a-bit-part series here](https://blog.marcgravell.com/2018/07/pipe-dreams-part-1.html)\n- \"Kestrel\", combined with pipelines, now provides a great hosting experience for high volume servers\n- HTTP/2 (and above) have reduced the usefulness of web-sockets (one of the main drivers for me and NetGain), since the web-sockets drafts for HTTP/2 never really \"took\"\n\nAs of late 2018, Stack Overflow (Stack Exchange) have migrated away from NetGain, instead using Kestrel's **inbuilt** web-socket support over HTTP/1.*; it is entirely possible that as we delve more into HTTP/2, we look more in the direction of [SSE](https://en.wikipedia.org/wiki/Server-sent_events) (`EventSource`).\n\nSo: we're not actively working with, or working on, this library. If you have a burning desire to take it further as an official maintainer (perhaps with some tweaks to naming, obviously) - let me know!\n\n---\n\n**NetGain** supports:\n\n- **[RFC 6455](https://tools.ietf.org/html/rfc6455)**\n- all draft versions of the RFC (between hixie-76 and v13, aka RFC 6455)  \n-  [hixie-76/hybi-00](https://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76)\n- fixes for various browsers with slightly broken implementations\n\n## Build ##\n\nStackExchange.NetGain is built as a single assembly, **StackExchange.NetGain.dll**.\n\n### NuGet Gallery ###\n\nStackExchange.NetGain is available on the **[NuGet Gallery]**\n\n- **[NuGet Gallery: stackexchange.netgain]**\n\nYou can add StackExchange.NetGain to your project with the **NuGet Package Manager**, by using the following command in the **Package Manager Console**.\n\n    PM\u003e Install-Package StackExchange.NetGain\n\n### WebSocket Server Example ###\n\n```csharp\nusing System;\nusing System.Net;\nusing StackExchange.NetGain;\nusing StackExchange.NetGain.WebSockets;\n\nnamespace Example\n{\n  public class Program\n  {\n    public static void Main (string[] args)\n    {\n\t\tIPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, 6002);\n\t\tusing(var server = new TcpServer())\n\t\t{\n\t\t\tserver.ProtocolFactory = WebSocketsSelectorProcessor.Default;\n\t\t\tserver.ConnectionTimeoutSeconds = 60;\n\t\t\tserver.Received += msg =\u003e\n\t\t\t{\n\t\t\t\tvar conn = (WebSocketConnection)msg.Connection;\n\t\t\t\tstring reply = (string)msg.Value + \" / \" + conn.Host;\n\t\t\t\tConsole.WriteLine(\"[server] {0}\", msg.Value);\n\t\t\t\tmsg.Connection.Send(msg.Context, reply);\n\t\t\t};\n\t\t\tserver.Start(\"abc\", endpoint);\n\t\t\tConsole.WriteLine(\"Server running\");\n\n\t\t\tConsole.ReadKey();\n\t\t}\n\t\tConsole.WriteLine(\"Server dead; press any key\");\n\t\tConsole.ReadKey();\n      }\n    }\n  }\n}\n```\n\n","funding_links":[],"categories":["C# #","WebSocket","Tools per Language"],"sub_categories":["C\\#"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStackExchange%2FNetGain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStackExchange%2FNetGain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStackExchange%2FNetGain/lists"}