{"id":20041577,"url":"https://github.com/ryinner/web-socket-manager","last_synced_at":"2026-05-12T00:50:32.106Z","repository":{"id":171303984,"uuid":"647625694","full_name":"ryinner/web-socket-manager","owner":"ryinner","description":"Simplе WebSocket wrapper.","archived":false,"fork":false,"pushed_at":"2023-06-13T07:45:09.000Z","size":225,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T19:27:20.822Z","etag":null,"topics":["javascript","typescript","websocket","websocket-client"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@ryinner/web-socket-manager","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryinner.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":"2023-05-31T07:22:41.000Z","updated_at":"2023-06-02T06:49:19.000Z","dependencies_parsed_at":"2023-07-21T17:01:58.997Z","dependency_job_id":null,"html_url":"https://github.com/ryinner/web-socket-manager","commit_stats":null,"previous_names":["ryinner/web-socket-manager","ryinner/websocketmanager"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryinner%2Fweb-socket-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryinner%2Fweb-socket-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryinner%2Fweb-socket-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryinner%2Fweb-socket-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryinner","download_url":"https://codeload.github.com/ryinner/web-socket-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241470401,"owners_count":19968041,"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":["javascript","typescript","websocket","websocket-client"],"created_at":"2024-11-13T10:47:10.434Z","updated_at":"2026-05-12T00:50:32.054Z","avatar_url":"https://github.com/ryinner.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebSocketManager\n\nThat a simple webSocket wrapper.\n\n## Install\n\n```bash\nnpm install @ryinner/web-socket-manager --save\n```\n\n## Usage\n\n```typescript\n//Only one ws\nconst ws = createWebSocket({ url: 'url' });\n\n// add operation - interval server request\n// if you add same operation, its handler will add to operation handlers.\nws.addOperation\u003cMyAnswerInterface\u003e({\n    method: 'method',\n    request: () =\u003e {\n        const computed = 1;\n        return { myFieldToWebSocket: computed };\n    },\n    handlers: [\n        (answerFromServer) =\u003e {\n            // smth\n        }\n    ]\n});\n\n// remove operation\nws.removeOperation('method');\n\n//remove handler\nws.removeHandler('method', handler);\n\n// start websocket\nws.open();\n\n// close websocket\nws.close();\n\n// also you can use it in multiply mode\nconst wsList = createWebSocket({ base: { url: 'url' }, interval: { url: 'url2', additionalQueryParams: { secret_key: 123 }, interval: 3000 } });\n\n// get wsManager\nwsList.getConnection('base');\n\nconst handler = (answerFromServer) =\u003e {\n    // smth\n};\n\n// push operation to base\nwsList.addOperation('base', {\n    method: 'method',\n    request: () =\u003e {\n        const computed = 1;\n        return { myFieldToWebSocket: computed };\n    },\n    handlers: [\n        handler\n    ]\n});\n// remove handler\nwsList.removeHandler('test', 'method', handler);\n// remove operation\nwsList.removeOperation('test', 'method');\n```\n\n## Server answer\n\nManager expect this server answer format.\n\n```json \n{\n    \"method\": \"methodName\",\n    \"data\": {\n        \"someDataField\": 1\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryinner%2Fweb-socket-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryinner%2Fweb-socket-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryinner%2Fweb-socket-manager/lists"}