{"id":18518654,"url":"https://github.com/kuyoonjo/tauri-plugin-tcp","last_synced_at":"2025-04-09T08:31:52.580Z","repository":{"id":258541440,"uuid":"875181265","full_name":"kuyoonjo/tauri-plugin-tcp","owner":"kuyoonjo","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-20T19:14:16.000Z","size":200,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T04:02:08.548Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/kuyoonjo.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-10-19T10:01:15.000Z","updated_at":"2025-03-09T21:07:49.000Z","dependencies_parsed_at":"2024-10-21T13:04:25.638Z","dependency_job_id":null,"html_url":"https://github.com/kuyoonjo/tauri-plugin-tcp","commit_stats":null,"previous_names":["kuyoonjo/tauri-plugin-tcp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuyoonjo%2Ftauri-plugin-tcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuyoonjo%2Ftauri-plugin-tcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuyoonjo%2Ftauri-plugin-tcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuyoonjo%2Ftauri-plugin-tcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuyoonjo","download_url":"https://codeload.github.com/kuyoonjo/tauri-plugin-tcp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248003194,"owners_count":21031745,"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-11-06T17:14:06.055Z","updated_at":"2025-04-09T08:31:52.309Z","avatar_url":"https://github.com/kuyoonjo.png","language":"Rust","funding_links":[],"categories":["Development"],"sub_categories":["Plugins"],"readme":"# tauri-plugin-tcp\n\nThis plugin only works with Tauri 2.x only.\n\n## Install\n\n```bash\ncargo add tauri-plugin-tcp\n```\n```bash\nnpm i @kuyoonjo/tauri-plugin-tcp\n```\n\n## Usage\n\n### rust\n```rust\n\ntauri::Builder::default()\n    .plugin(tauri_plugin_tcp::init())\n    ...\n```\n\n### javascript\n```javascript\nimport { connect, disconnect, send, listen } from \"@kuyoonjo/tauri-plugin-tcp\";\n\n// Server side\nconst sid = 'unique-server-id';\nawait bind(sid, '0.0.0.0:8080');\nawait send(sid, '192.168.1.2:9090', 'hello');\nlet clientAddr = '';\nawait listen((x) =\u003e {\n  console.log(x.payload);\n  if (x.payload.id === sid \u0026\u0026 x.payload.event.connect) {\n    clientAddr = x.payload.event.connect;\n    await send(sid, 'hello', clientAddr);\n  }\n});\nawait unbind(sid);\n\n// Client side\nconst cid = 'unique-client-id';\nawait connect(cid, '0.0.0.0:8080');\nawait listen((x) =\u003e {\n  console.log(x.payload);\n  if (x.payload.id === cid \u0026\u0026 x.payload.event.message) {\n    // npm i buffer\n    // import { Buffer } from 'buffer';\n    let str = Buffer.from(x.payload.event.message.data).toString();\n    if (str === 'hello')\n      await send(cid, 'world');\n  }\n});\nawait disconnect(cid);\n```\n\n#### Event Payload Interface\n```typescript\nexport interface Payload {\n  id: string;\n  event: {\n    bind?: string;\n    unbind?: [];\n    connect?: string;\n    disconnect?: string;\n    message?: {\n      addr: string;\n      data: number[];\n    };\n  };\n}\n```\n\n### permissions\n\nadd `\"tcp:default\"` into `\"permissions\"` list of `src-tauri\\capabilities\\default.json`\n\n```json\n{\n  \"$schema\": \"../gen/schemas/desktop-schema.json\",\n  ...\n  \"permissions\": [\n    \"core:default\",\n    ...\n    \"tcp:default\"\n  ]\n}\n```\n\n## Support\n\n| MacOS | Linux | Windows |\n| ----- | ----- | ------- |\n| ✅    | ✅    | ✅      |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuyoonjo%2Ftauri-plugin-tcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuyoonjo%2Ftauri-plugin-tcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuyoonjo%2Ftauri-plugin-tcp/lists"}