{"id":15043757,"url":"https://github.com/cheesegrinder/stencil-socket.io","last_synced_at":"2025-10-16T11:30:57.781Z","repository":{"id":275338436,"uuid":"356355214","full_name":"CheeseGrinder/stencil-socket.io","owner":"CheeseGrinder","description":"Tool adding decorators in StencilJS to interface more easily socket.io.","archived":true,"fork":false,"pushed_at":"2021-05-02T14:56:05.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T19:45:25.489Z","etag":null,"topics":["decorators","front-end","socket-io","stenciljs","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/stencil-socket.io","language":"TypeScript","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/CheeseGrinder.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":"2021-04-09T17:49:23.000Z","updated_at":"2025-01-18T17:31:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"22dd00d9-ec70-4476-b50e-7fa9eac65bcd","html_url":"https://github.com/CheeseGrinder/stencil-socket.io","commit_stats":null,"previous_names":["cheesegrinder/stencil-socket.io"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheeseGrinder%2Fstencil-socket.io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheeseGrinder%2Fstencil-socket.io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheeseGrinder%2Fstencil-socket.io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheeseGrinder%2Fstencil-socket.io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CheeseGrinder","download_url":"https://codeload.github.com/CheeseGrinder/stencil-socket.io/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236713495,"owners_count":19193079,"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":["decorators","front-end","socket-io","stenciljs","typescript"],"created_at":"2024-09-24T20:49:33.477Z","updated_at":"2025-10-16T11:30:57.775Z","avatar_url":"https://github.com/CheeseGrinder.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"./assets/banner.png\"/\u003e\n  \u003cp\u003eHelper to use socket.io on StencilJS\u003c/p\u003e\n\n  \u003ca href=\"https://github.com/CheeseGrinder/stencil-socket.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/CheeseGrinder/stencil-socket.io\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/CheeseGrinder/stencil-socket.io\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/stencil-socket.io\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/CheeseGrinder/stencil-socket.io\"\u003e\n    \u003cimg src=\"https://github.com/CheeseGrinder/stencil-socket.io/actions/workflows/npm-publish.yml/badge.svg\"/\u003e\n  \u003c/a\u003e\n  \n\u003c/div\u003e\n\n## Description 📄\n\u003cp\u003eStencil-socket.io is a helper for using \u003ca href=\"https://socket.io/\"\u003esocket.io\u003c/a\u003e with Stencil\u003c/p\u003e\n\n## Install 📦️\n```bash\nnpm i stencil-socket.io\n```\n## How to use ✏️\n\nIn the shared directory, create a file with the following code :\n```ts\n// socket.ts\nimport { StencilSocket } from 'stencil-socket.io';\n\nexport const socket = StencilSocket('foo.bar');\n```\n\nIn a component or class:\n```tsx\nimport { Component, h, State } from '@stencil/core';\nimport { Socket } from 'socket.io-client';\nimport { IoEmmiter } from 'stencil-socket.io';\nimport { socket } from 'shared/socket';\n\n@Component({\n  tag: 'some-component'\n})\nexport class SomeComponent {\n\n  private socketIsConnected: boolean = false;\n\n  @State() data: number = 0;\n\n  @socket.Instance() socket: Socket;\n\n  @socket.Emit('socket:event') emmiter: IoEmmiter\u003cnumber\u003e;\n\n  @socket.Receive('socket:event') onReceive(data: number): void {\n    this.data = data;\n  }\n\n  @socket.Connect() onConnect(): void {\n    this.socketIsConnected = true;\n  }\n\n  @socket.Disonnect() ondisconnect(): void {\n    this.socketIsConnected = false;\n  }\n\n  /** alternative to @Connect and @Disconnect */\n  @socket.Status() onSocketstatusChange(connected: boolean): void {\n    this.socketIsConnected = connected;\n  }\n\n  private emit(): void {\n    this.emmiter.emit(this.data);\n  }\n\n  render() {\n    // Render a beautiful component\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheesegrinder%2Fstencil-socket.io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheesegrinder%2Fstencil-socket.io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheesegrinder%2Fstencil-socket.io/lists"}