{"id":4731,"url":"https://github.com/indatawetrust/react-native-nchan","last_synced_at":"2025-08-04T02:31:24.853Z","repository":{"id":57338634,"uuid":"84488386","full_name":"indatawetrust/react-native-nchan","owner":"indatawetrust","description":"NPM package for the Javasript React Native for Nchan","archived":false,"fork":true,"pushed_at":"2020-01-30T10:43:07.000Z","size":27,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T09:13:04.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"slact/nchan.js","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indatawetrust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T21:03:16.000Z","updated_at":"2021-07-03T12:32:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/indatawetrust/react-native-nchan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/indatawetrust/react-native-nchan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Freact-native-nchan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Freact-native-nchan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Freact-native-nchan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Freact-native-nchan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indatawetrust","download_url":"https://codeload.github.com/indatawetrust/react-native-nchan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indatawetrust%2Freact-native-nchan/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268434752,"owners_count":24250033,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-01-05T20:17:21.609Z","updated_at":"2025-08-04T02:31:24.533Z","avatar_url":"https://github.com/indatawetrust.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["Backend"],"readme":"# NchanSubscriber.js\n\nA Websocket, EventSource, and Long-Polling wrapper for [Nchan](https://nchan.slact.net)\n\n```js\n// CommonJS\n\nimport NchanSubscriber from 'react-native-nchan'\n\n//options\nlet opt = {\n  subscriber: 'longpoll', 'eventsource', or 'websocket',\n    //or an array of the above indicating subscriber type preference\n  reconnect: undefined,\n  shared: undefined\n}\n\nconst sub = new NchanSubscriber(url, opt);\n\nsub.on(\"message\", function(message, message_metadata) {\n  // message is a string\n  // message_metadata is a hash that may contain 'id' and 'content-type'\n});\n\nsub.on('connect', function(evt) {\n  //fired when first connected.\n});\n\nsub.on('disconnect', function(evt) {\n  // when disconnected.\n});\n\nsub.on('error', function(error_code or evt, error_description) {\n  //error callback\n});\n\nsub.reconnect; // should subscriber try to reconnect? true by default.\nsub.reconnectTimeout; //how long to wait to reconnect? does not apply to EventSource, which reconnects on its own.\nsub.lastMessageId; //last message id. useful for resuming a connection without loss or repetition.\n\nsub.start(); // begin (or resume) subscribing\nsub.stop(); // stop subscriber. do not reconnect.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findatawetrust%2Freact-native-nchan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findatawetrust%2Freact-native-nchan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findatawetrust%2Freact-native-nchan/lists"}