{"id":13732183,"url":"https://github.com/deplinenoise/webby","last_synced_at":"2025-06-22T08:06:02.948Z","repository":{"id":4058565,"uuid":"5161901","full_name":"deplinenoise/webby","owner":"deplinenoise","description":"A tiny webserver for game development","archived":false,"fork":false,"pushed_at":"2024-01-14T22:28:01.000Z","size":276,"stargazers_count":278,"open_issues_count":8,"forks_count":32,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-14T23:33:54.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deplinenoise.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-07-24T06:21:46.000Z","updated_at":"2024-09-21T04:36:12.000Z","dependencies_parsed_at":"2024-11-14T23:31:38.075Z","dependency_job_id":"a515a67b-f402-4d0d-9d49-f3c10f8a63ed","html_url":"https://github.com/deplinenoise/webby","commit_stats":{"total_commits":22,"total_committers":5,"mean_commits":4.4,"dds":"0.36363636363636365","last_synced_commit":"8f4b58796a9cf0e32d28f1236e0cc5faba010c88"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deplinenoise/webby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fwebby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fwebby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fwebby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fwebby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deplinenoise","download_url":"https://codeload.github.com/deplinenoise/webby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deplinenoise%2Fwebby/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261257108,"owners_count":23131520,"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-03T02:01:48.526Z","updated_at":"2025-06-22T08:05:57.936Z","avatar_url":"https://github.com/deplinenoise.png","language":"C","readme":"\n# Webby - A simple web server for game debugging #\n\nWebby is a web server intended for debugging tools inside a game or other\nprogram with a continously running main loop. It's intended to be used when\nall you need is something tiny and performance isn't a key concern.\n\n## Features ##\n\n- No dynamic memory allocations -- server memory is completely fixed\n- No threading, all I/O and serving happens on the calling thread\n- Supports socket keep-alives\n- Supports the 100-Continue scheme for file uploading\n- Basic support for WebSockets is available.\n\nBecause request/response I/O is synchronous on the calling thread, performance\nwill suffer when you are serving data. For the use-cases Webby is intended for,\nthis is fine. You can still run Webby in a background thread at your\ndiscretion if this is a problem.\n\n## Usage ##\n\n- Fill in a `WebbyServerConfig` structure\n- Compute the memory requirements by calling `WebbyServerMemoryNeeded()`\n- Allocate memory (or just use a static char array..)\n- Initialize the server by calling `WebbyServerInit()`\n- Every game frame, call `WebbyServerUpdate()`\n  - Handle requests in your dispatch function\n- When it's time to shut down, call `WebbyServerShutdown()`\n\n## WebSocket Usage ##\n\n- Provide the `WEBBY_SERVER_WEBSOCKETS` flag at init time\n- In your `ws_connect` handler, decide to allow the upgrade request.\n- When the connection is established, your `ws_connected` handler is called. At this point, you can start sending WebSocket frames over the connection (and you can get incoming frames as well).\n- As frames come in, your `ws_frame` handler will be called. Webby doesn't try to merge frames together when the data is split into fragments, so you can be getting one binary/text frame followed by any number of continuation frames. It's up to your handler to make sense of the data and build a buffer as appropriate. The rationale is that otherwise Webby would need a lot more buffer space. To read the frame data, look at the payload size and then call `WebbyRead` to get at the data. Be careful to not read more than what is stated, or you will screw up the protocol.\n- To send WebSocket data, call `WebbyBeginSocketFrame`, passing in the type of frame (typically `WEBBY_WS_OP_TEXT_FRAME` or `WEBBY_WS_OP_BINARY_FRAME`). Then write an arbitrary amount of data using `WebbyWrite`. When you're done, call `WebbyEndSocketFrame`. Webby currently emits one WebSocket (continuation) frame for each `WebbyWrite` call (again, to reduce buffering overhead), so try to write big chunks if you can.\n- When a connection is closed, you will get a call to your `ws_closed` handler.\n\n## Request handling ##\n\nWhen you configure the server, you give it a function pointer to your\ndispatcher. The dispatcher is called by Webby when a request has been fully\nread into memory and is ready for processing. The socket the request came in on\nhas then been switched to blocking mode, and you're free to read any request\ndata using `WebbyRead()` (if present, check `content_length`) and then write\nyour response.\n\nThere are two ways to generate a response; explicit size or chunked.\n\n### When you know the size of the data ###\n\nWhen you know in advance how big the response is going to be, you should pass\nthat size in bytes to `WebbyBeginResponse()` (it will be sent as the\nContent-Length header). You then call `WebbyWrite()` to push that data out, and\nfinally `WebbyEndResponse()` to finalize the response and prepare the socket\nfor a new request.\n\n### When the response size is dynamic ###\n\nSometimes you want to generate an arbitrary amount of text in the response, and\nyou don't know how much that will be. Rather than buffering everything in RAM,\nyou can use chunked encoding. First call `WebbyBeginResponse()` as normal, but\npass it -1 for the content length. This triggers sending the\n`Transfer-Encoding: chunked` header. You then call `WebbyWrite()` or\n`WebbyPrintf()` as desired until the response is complete. When you're done,\ncall `WebbyEndResponse()` to finish up.\n\n## Limitations ##\n\n- There is not much error checking. \n\n## Author ##\n\nWebby was written by Andreas Fredriksson (@deplinenoise on Twitter).\n\n## License ##\n\nWebby is available under the BSD license. See the file `LICENSE`.\n","funding_links":[],"categories":["Networking"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeplinenoise%2Fwebby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeplinenoise%2Fwebby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeplinenoise%2Fwebby/lists"}