{"id":15366939,"url":"https://github.com/fortis/react-cent","last_synced_at":"2025-08-08T07:22:10.374Z","repository":{"id":94303532,"uuid":"108891321","full_name":"fortis/react-cent","owner":"fortis","description":"React Component to make realtime apps with React simply. Provides integration with Centrifugo.","archived":false,"fork":false,"pushed_at":"2019-01-12T17:29:55.000Z","size":43,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T07:47:44.749Z","etag":null,"topics":["centrifuge","centrifugo","react","reactjs","real-time","sockjs","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fortis.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":"2017-10-30T18:25:18.000Z","updated_at":"2023-02-27T07:55:48.000Z","dependencies_parsed_at":"2023-04-16T06:00:29.454Z","dependency_job_id":null,"html_url":"https://github.com/fortis/react-cent","commit_stats":{"total_commits":77,"total_committers":3,"mean_commits":"25.666666666666668","dds":0.1298701298701299,"last_synced_commit":"3804c756b7ec3298c7e563250ccf57a12cfda88d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fortis/react-cent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortis%2Freact-cent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortis%2Freact-cent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortis%2Freact-cent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortis%2Freact-cent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortis","download_url":"https://codeload.github.com/fortis/react-cent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortis%2Freact-cent/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269381155,"owners_count":24407765,"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-08T02:00:09.200Z","response_time":72,"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":["centrifuge","centrifugo","react","reactjs","real-time","sockjs","websocket"],"created_at":"2024-10-01T13:20:28.622Z","updated_at":"2025-08-08T07:22:10.307Z","avatar_url":"https://github.com/fortis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-cent\n\nMail.ru Centrifuge integration component\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-cent\"\u003e\u003cimg alt=\"npm version\" src=\"https://img.shields.io/npm/v/react-cent.svg?style=flat-square\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://scrutinizer-ci.com/g/fortis/react-cent\"\u003e\u003cimg alt=\"Scrutinizer Code Quality\" src=\"https://scrutinizer-ci.com/g/fortis/react-cent/badges/quality-score.png?b=master\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://app.fossa.io/projects/git%2Bgithub.com%2Ffortis%2Freact-cent?ref=badge_shield\" alt=\"FOSSA Status\"\u003e\u003cimg src=\"https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffortis%2Freact-cent.svg?type=shield\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/fortis/react-cent\"\u003e\u003cimg src=\"https://travis-ci.org/fortis/react-cent.svg?branch=master\" alt=\"travis-ci status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/fortis/react-cent\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/fortis/react-cent/badge.svg\" alt=\"coverage status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://standardjs.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/code_style-standard-brightgreen.svg\" alt=\"Standard - JavaScript Style Guide\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://raw.githubusercontent.com/fortis/react-cent/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ffortis%2Freact-cent.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffortis%2Freact-cent?ref=badge_large)\n\n## Prerequisites\n\nFirstly you should run Centrifugo server.\n\nStart it with [Docker image](https://docker.com)\n```jsx harm\n docker run --ulimit nofile=65536:65536 -p 8000:8000 centrifugo/centrifugo centrifugo --admin --web --insecure_admin\n```\n`--admin --web --insecure_admin` - used for development purposes to enable admin interface and skip password prompt.\n\nOpen [http://localhost:8000](http://localhost:8000)\n![](https://pp.userapi.com/c841329/v841329697/36aaa/B7-bq-u3Fyw.jpg)\n\nFor alternative installation methods and production usage see: [Install Centrifugo and quick start](https://fzambia.gitbooks.io/centrifugal/content/server/start.html). \n\n## Installation\n\nTo get the latest version, simply install the package using npm:\n```sh\nnpm install react-cent --save\n```\n\n## Usage\n\nYou can disable token authentication with `insecure: true` parameter, but this mode is mostly for personal and demonstration uses.\n\nAll configuration parameters are described in centrifuge-js [documentation](https://fzambia.gitbooks.io/centrifugal/content/clients/javascript.html#configuration-parameters)\n\nAdd provider:\n\n```jsx harmony\n\nconst config = {\n    url: 'http://localhost:8000/connection/websocket',\n    insecure: true, // disable token auth\n    // user: 'USER ID',\n    // timestamp: 'UNIX TIMESTAMP',\n    // token: 'TOKEN',\n}\n\nReactDOM.render(\n    \u003cProvider store={store}\u003e\n      \u003cCentProvider config={config}\u003e\n        \u003cRouter\u003e\n          \u003cRoute path=\"/\" component={App} /\u003e\n        \u003c/Router\u003e\n      \u003c/CentProvider\u003e\n    \u003c/Provider\u003e,\n    document.getElementById('app')\n)\n```\n\nHandle messages:\n\n```jsx harmony\nimport React from 'react'\nimport { cent } from 'react-cent'\n\n// Make Centrifuge client accessible through `this.props.cent`\n@cent \nexport class SiteMetrics extends React.Component {\n    constructor (props) {\n      super(props)\n\n      // Subscribe on `site-metrics` channel.\n      this.props.cent.subscribe('site-metrics', message =\u003e {\n        this.handleMessage(message)\n      }).history().then(history =\u003e {\n        this.handleHistory(history)\n      })\n    }\n    \n    handleMessage(message) {\n      console.log('message', message.data)\n    }\n    \n    handleHistory(history) {\n      console.log('history' , history.data)\n    }\n}\n```\n\n## SockJS (optional)\n\nInstall package\n```npm\nnpm install sockjs-client --save\n```\n\nUpdate provider configuration\n```jsx harmony\nimport SockJS from 'sockjs-client'\n\nconst config = {\n    // Change connection url.\n    url: 'http://localhost:8000/connection',\n    // Add SockJS client option.  \n    sockJS: SockJS\n}\n```\n\n### Documentation\n* [Javascript browser client](https://fzambia.gitbooks.io/centrifugal/content/clients/javascript.html)\n* [Configuration parameters](https://fzambia.gitbooks.io/centrifugal/content/clients/javascript.html#configuration-parameters)\n* [Subscriptions](https://fzambia.gitbooks.io/centrifugal/content/clients/javascript.html#subscriptions)\n* [SockJS](https://fzambia.gitbooks.io/centrifugal/content/clients/javascript.html#sockjs)\n\n## Built With\n\n* [CentrifugeJS](https://github.com/centrifugal/centrifuge-js) - Javascript client to communicate with Centrifugo from web browser over Websockets or SockJS\n* [React](https://github.com/facebook/react) - A declarative, efficient, and flexible JavaScript library for building user interfaces.\n\n## Building \u0026 Testing\n\n*  source can be loaded via [npm](https://www.npmjs.com/package/react-cent), or [downloaded](https://github.com/fortis/react-cent/archive/master.zip) from github repo.\n* `npm run build` to build\n* `npm test` to run tests\n\n## License\n\n`react-cent` is licensed under [The MIT License (MIT)](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortis%2Freact-cent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortis%2Freact-cent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortis%2Freact-cent/lists"}