{"id":16328282,"url":"https://github.com/nicolasff/river","last_synced_at":"2025-03-22T22:31:23.339Z","repository":{"id":488894,"uuid":"115052","full_name":"nicolasff/river","owner":"nicolasff","description":"A simple “comet” server in C, streaming data to web clients","archived":false,"fork":false,"pushed_at":"2011-02-13T13:25:06.000Z","size":359,"stargazers_count":24,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-11T23:14:10.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/nicolasff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-01-26T17:03:46.000Z","updated_at":"2021-02-19T03:35:13.000Z","dependencies_parsed_at":"2022-07-07T14:03:35.973Z","dependency_job_id":null,"html_url":"https://github.com/nicolasff/river","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/nicolasff%2Friver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasff%2Friver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasff%2Friver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolasff%2Friver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolasff","download_url":"https://codeload.github.com/nicolasff/river/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221840395,"owners_count":16889794,"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-10-10T23:14:13.253Z","updated_at":"2024-10-28T14:28:45.325Z","avatar_url":"https://github.com/nicolasff.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### COMPILE\n\nYou need to fetch the http-parser submodule, by typing:\n\u003cpre\u003e\ngit submodule init\ngit submodule update\n\u003c/pre\u003e\n\n\n#### Run demo\n1 - run `make clean all`  \n2 - run `./river`\n\n3 - In a terminal, run:\n\u003cpre\u003e\ncurl -N -d \"name=public-channel\" \"http://127.0.0.1:9271/subscribe\"\n\u003c/pre\u003e\nThe call to `/subscribe` is blocking.\n\n\n4 - And then, in another terminal:\n\u003cpre\u003e\ncurl -d \"name=public-channel\u0026data=hello-world-of-comet\" \"http://127.0.0.1:9271/publish\"\n\u003c/pre\u003e\n\n5 - The call to `/subscribe` returns, with the data published in the channel.\n\n\n### Embed in an HTML page\nThe following example considers the page to be at `example.com`, and the comet server at `river.example.com`.\n\n1 - Add a reference to the `lib.js` script in your page:\n\u003cpre\u003e\n\t\u0026lt;script type=\"text/javascript\" src=\"http://river.example.com/lib.js?domain=example.com\"\u0026gt;\u0026lt;/script\u0026gt;\n\u003c/pre\u003e\n2 - Initialize the server:\n\u003cpre\u003e\n\tdocument.domain = \"example.com\";\n\n\tfunction onMsg(msg) {\n\t\talert(\"received message: \", msg);\n\t}\n\n\tComet.init(function() {\n\t\tvar c = new Comet.Client();\n\t\tc.connect(\"public-channel\", onMsg); // call onMsg upon reception of a message.\n\t});\n\u003c/pre\u003e\n3 - The `onMsg` function will now receive all messages published on `public-channel`.\n\n\n### Notes\n* Parameters can be sent in GET or POST.\n* /subscribe takes 3 more (optional) parameters:\n    * `keep`: Use HTTP streaming or close connection after every push (value=`0` or `1`, defaults to `1`)\n    * `seq`: Stream messages from a the sequence number up. Example: If 1000 messages have been sent, `seq=990` will push 10 messages.\n    * `callback`: function name for a JSONP callback.\n* The *tests* directory contains two benchmarking programs, `websocket` and `bench`. They can simulate large numbers of concurrent clients reading and writing messages. A single core can process more than 450,000 messages per second.\n\n### Chat Demo\nA chat demo is available in the `chat-demo` directory. In order to use it, follow these steps:\n\n* Add the line `127.0.0.1\twww.chat-demo.com river.chat-demo.com` to your `/etc/hosts` file.\n* Configure your web server to server the index.html file for `www.chat-demo.com`. On Apache2: \n\u003cpre\u003e\n\u0026lt;VirtualHost *:80\u0026gt;\n\tServerName www.chat-demo.com\n\tDocumentRoot /var/www/chat-demo.com\n\u0026lt;/VirtualHost\u0026gt;\n\u003c/pre\u003e\n* Restart Apache.\n* Start river.\n* Open `www.chat-demo.com` in your web browser.\n\n#### TODO\n* Test support for Flash’s `\u003cpolicy-file-request\u003e\\0` in the WebSocket implementation.\n* More efficient channel deletion.\n* Remove dependency on dict.c in channels, use own HT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasff%2Friver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolasff%2Friver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolasff%2Friver/lists"}