{"id":16132687,"url":"https://github.com/sbrl/glidingsquirrel","last_synced_at":"2025-06-17T03:05:37.879Z","repository":{"id":87743710,"uuid":"111020624","full_name":"sbrl/GlidingSquirrel","owner":"sbrl","description":"A http + websockets server, implemented in C#. Originally built for the /r/dailyprogrammer hard challenge #322.","archived":false,"fork":false,"pushed_at":"2018-08-26T20:09:42.000Z","size":927,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-17T03:05:37.161Z","etag":null,"topics":["csharp","http-server","library","websocket-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbrl.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-16T20:47:55.000Z","updated_at":"2024-03-12T10:27:46.000Z","dependencies_parsed_at":"2023-07-09T06:01:34.146Z","dependency_job_id":null,"html_url":"https://github.com/sbrl/GlidingSquirrel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sbrl/GlidingSquirrel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrl%2FGlidingSquirrel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrl%2FGlidingSquirrel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrl%2FGlidingSquirrel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrl%2FGlidingSquirrel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbrl","download_url":"https://codeload.github.com/sbrl/GlidingSquirrel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbrl%2FGlidingSquirrel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260281565,"owners_count":22985627,"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":["csharp","http-server","library","websocket-server"],"created_at":"2024-10-09T22:32:48.070Z","updated_at":"2025-06-17T03:05:37.867Z","avatar_url":"https://github.com/sbrl.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![](https://github.com/sbrl/GlidingSquirrel/blob/master/logo.png?raw=true) GlidingSquirrel\n\nA http (and Websockets!) server, implemented in C#.\n\nOriginally built for the /r/dailyprogrammer [hard challenge #322](https://www.reddit.com/r/dailyprogrammer/comments/6lti17/20170707_challenge_322_hard_static_http_server/).\n\nGlidingSquirrel is currently in alpha testing! Don't use this in production unless you really know what you're doing :P\n\nThe logo is temporary!\n\n## Features\n - HTTP 1.0 / 1.1 (RFC 1945 / RFC 1616) supported (mostly - bug reports \u0026 pull requests welcome :D)\n - Uses C\u0026sharp; 7\n - Does not have anything to do with `System.Net.HttpServer` whatsoever at all\n - Easily extendable (it's an abstract class)\n - Supports client requests with bodies (e.g. `POST` and `PUT`, but any http verb with a `content-length` will work)\n - Supports `HEAD` requests\n - Parses and respects the `Accepts` HTTP header\n - Supports keep-alive connections (HTTP 1.1 only, of course)\n - Supports Websockets (RFC 6455, Initial implementation, version 13 only, needs thorough testing - detailed bug reports welcome :D)\n - Global configurable logging level\n - Ability to cleanly shut the server down\n\n## Todo\n - Trailing headers\n - Give implementors of `WebsocketServer` a cleaner way to decide whether they want to accept a connection or not\n\n## Getting Started\nStart by making sure your project is using the .NET framework 4.6.2 or higher, and then install the `GlidingSquirrel` (pre-release) [NuGet package](https://www.nuget.org/packages/GlidingSquirrel/). Here's an overview of the important classes you'll probably come into contact with:\n\n - HTTP\n\t - `SBRL.GlidingSquirrel.Http.HttpServer` - The main HTTP server class. Inherit from this to create a HTTP server.\n\t - `SBRL.GlidingSquirrel.Http.HttpRequest` - Represents HTTP requests incoming from clients.\n\t - `SBRL.GlidingSquirrel.Http.HttpResponse` - Represents the HTTP response   that will be sent by to the client.\n\t - `SBRL.GlidingSquirrel.Http.HttpMessage` - The base class that `HttpRequest` and `HttpResponse` inherit from.\n\t - `SBRL.GlidingSquirrel.Http.HttpResponseCode` - Represents a HTTP response code that is returned to the client.\n - Websockets\n\t - `SBRL.GlidingSquirrel.Websocket.WebsocketServer` - The main Websockets server class. Inherit from this to create a websockets-capable server!\n\t - `SBRL.GlidingSquirrel.Websocket.WebsocketClient` - Represents a single Websocket client.\n\t - `SBRL.GlidingSquirrel.Websocket.WebsocketFrame` - Represents a single frame received from / about to be sent to a client.\n - `SBRL.GlidingSquirrel.Log` - The global logging class that all log messages flow through. Can be tuned to increase / decrease the verbosity of the logging messages.\n - `SBRL.GlidingSquirrel.LogLevel` - The enum that contains the different logging levels.\n\nThe best way I'm currently aware of to get an idea as to how to utilise this library for yourself is to take a look at the [demo server modes](https://github.com/sbrl/GlidingSquirrel/tree/master/GlidingSquirrelCLI/Modes) built into the CLI project that's part of the main GlidingSquirrel solution.\n\nGlidingSquirrel now has automatically generated documentation with mdoc! You can find it [here](https://sbrl.github.io/GlidingSquirrel/docs/).\n\n### Things to watch out for\n - If you don't set the response body (either with `response.SetBody()` or `response.Body = StreamReader`), then no response will be sent to the browser and clients will sit there waiting for a response indefinitely!\n - If you set the response body directly via `response.Body = StreamReader`, some clients may require the `ContentLength` property to be specified also (`response.SetBody()` does this automatically) - especially if a client is using a persistent connection.\n - As the GlidingSquirrel supports HTTP/1.1 persistent connection, you can tell it what (not?) to do with a connection either before or after sending a response via the `HttpConnectionAction` enum that you return a value from in `HandleRequest` (or `HandleHttpRequest` for websockets servers).\n\n## Useful Links\n - [Tuples in C# 7](https://www.thomaslevesque.com/2016/07/25/tuples-in-c-7/)\n - [Tackling Tuples: Understanding the New C# 7 Value Type](http://our.componentone.com/2017/01/30/tackling-tuples-understanding-the-new-c-7-value-type/)\n - [Writing Websocket Servers on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers)\n - [Websocket Spec RFC6455](https://tools.ietf.org/html/rfc6455#section-5.5.1)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbrl%2Fglidingsquirrel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbrl%2Fglidingsquirrel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbrl%2Fglidingsquirrel/lists"}