{"id":15768171,"url":"https://github.com/thk2b/socket.io-client-xcontrol","last_synced_at":"2025-07-11T07:38:51.866Z","repository":{"id":57365145,"uuid":"127776202","full_name":"thk2b/socket.io-client-xcontrol","owner":"thk2b","description":"A Controller for the socket.io client","archived":false,"fork":false,"pushed_at":"2018-05-11T16:31:49.000Z","size":25,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-25T02:42:34.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/thk2b.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}},"created_at":"2018-04-02T15:39:04.000Z","updated_at":"2018-05-11T16:33:24.000Z","dependencies_parsed_at":"2022-09-13T21:12:49.845Z","dependency_job_id":null,"html_url":"https://github.com/thk2b/socket.io-client-xcontrol","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/thk2b%2Fsocket.io-client-xcontrol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fsocket.io-client-xcontrol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fsocket.io-client-xcontrol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fsocket.io-client-xcontrol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thk2b","download_url":"https://codeload.github.com/thk2b/socket.io-client-xcontrol/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246457992,"owners_count":20780679,"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-04T14:00:34.348Z","updated_at":"2025-03-31T11:20:29.255Z","avatar_url":"https://github.com/thk2b.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"`npm install --save socket.io-client-xcontrol`\n\n# socket.io-client-xcontrol\nA Controller for the socket.io client\n\n# Goal\n\nThe goal of this package is to connect a websocket to a controller. Whenever specific actions are caused on a controller instance, messages should be emited through the socket.\n\n# Implementation\n\nThe `SocketIo` function takes a Controller class and method names, and returns a new class to be initialized with a socket.\nThis HOC overides the named methods and emits the method name, arguments and controller name through the socket.\nWhen initialized, the HOC listens for these actions on the socket, and triggers them on the controller when they are recieved.\nIt also listens for these actions on the controller, and emits them through the socket.\n\n# Usage\n\n```js\nimport SocketIo from 'socket.io-client-xcontrol'\n\nconst ConnectedTodos = SocketIo( Todos , ['create', 'delete', 'update'])\n\nconst todos = new ConnectedTodos(socket)\n```\nEquivalent to:\n```js\nclass Todos extends HashMap {\n    constructor(initialState, socket){\n      super(initialState)\n      this.socket = socket\n      socket.on('@@todos__create', args =\u003e this.create(args))\n    }\n    create(...args){\n       super.create(...args)\n       this.socket.emit('@@todos__create', args)\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthk2b%2Fsocket.io-client-xcontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthk2b%2Fsocket.io-client-xcontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthk2b%2Fsocket.io-client-xcontrol/lists"}