{"id":22685132,"url":"https://github.com/kartikmehta8/heartbeat","last_synced_at":"2026-05-02T13:32:13.474Z","repository":{"id":264951175,"uuid":"888582695","full_name":"kartikmehta8/heartbeat","owner":"kartikmehta8","description":"A master-slave monitoring system tracking slave server status, logging connections, and detecting unresponsive servers via heartbeat monitoring.","archived":false,"fork":false,"pushed_at":"2024-11-14T16:40:59.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-15T17:02:12.944Z","etag":null,"topics":["heartbeat","nodejs","socket-programming"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kartikmehta8.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-14T16:40:50.000Z","updated_at":"2024-11-14T16:42:10.000Z","dependencies_parsed_at":"2024-11-27T02:02:30.006Z","dependency_job_id":null,"html_url":"https://github.com/kartikmehta8/heartbeat","commit_stats":null,"previous_names":["kartikmehta8/heartbeat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kartikmehta8/heartbeat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikmehta8%2Fheartbeat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikmehta8%2Fheartbeat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikmehta8%2Fheartbeat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikmehta8%2Fheartbeat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kartikmehta8","download_url":"https://codeload.github.com/kartikmehta8/heartbeat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikmehta8%2Fheartbeat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32536576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["heartbeat","nodejs","socket-programming"],"created_at":"2024-12-09T22:13:16.748Z","updated_at":"2026-05-02T13:32:13.440Z","avatar_url":"https://github.com/kartikmehta8.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Master-Slave Monitoring System\n\nThis project implements a master-slave monitoring system in Node.js, where a master server maintains persistent connections to multiple slave servers, monitoring their heartbeat to check if they are alive. The master server logs the status of each connected slave and records when a slave connects, disconnects, or becomes unresponsive.\n\n## Project Structure\n\n```\nmaster-slave-monitoring\n├── master\n│   ├── index.js              # Master server entry point\n│   └── config.js             # Master server configuration\n├── slave\n│   ├── index.js              # Slave server entry point\n│   └── config.js             # Slave server configuration\n├── logs\n│   └── master.log            # Log file for master server\n└── package.json    \n```\n\n## Features\n\n- **Persistent Connection**: Slave servers maintain a persistent WebSocket connection to the master server.\n- **Heartbeat Monitoring**: Each slave sends a periodic \"heartbeat\" message to the master to indicate it's alive.\n- **Unresponsive Detection**: The master tracks the time since the last heartbeat from each slave and logs if a slave becomes unresponsive.\n- **Dynamic Slave Addition/Removal**: New slave servers can be added or removed dynamically, with real-time updates on their status.\n- **Logging**: Logs are maintained for each connection, disconnection, and unresponsive status of slaves.\n\n## Configuration\n\n### Master Configuration (in `master/config.js`)\n- **MASTER_PORT**: Port for the master server (default: `8080`)\n- **HEARTBEAT_INTERVAL**: Time in milliseconds before the master marks a slave as \"unresponsive\" if no heartbeat is received (e.g., `7000`).\n- **CHECK_INTERVAL**: Interval (in ms) for the master to check the heartbeat status of slaves.\n\n### Slave Configuration (in `slave/config.js`)\n- **MASTER_URL**: URL of the master server (e.g., `ws://localhost:8080`).\n- **HEARTBEAT_INTERVAL**: Interval (in ms) for the slave to send heartbeat messages to the master (e.g., `3000`).\n\n## Usage\n\n### 1. Start the Master Server\n\nTo start the master server, run:\n\n```bash\nnode master/index.js\n```\n\nThe master server will listen for connections on the configured port. Logs will be stored in the `logs/master.log` file.\n\n### 2. Start Slave Servers\n\nOpen a new terminal for each slave instance and run:\n\n```bash\nnode slave/index.js\n```\n\nEach slave will connect to the master and start sending periodic heartbeat messages. You can start as many slave instances as desired.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartikmehta8%2Fheartbeat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkartikmehta8%2Fheartbeat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartikmehta8%2Fheartbeat/lists"}