{"id":20817876,"url":"https://github.com/vforteli/dotnet-typescript-hub-generator","last_synced_at":"2026-02-02T12:47:29.267Z","repository":{"id":262150225,"uuid":"886289280","full_name":"vforteli/dotnet-typescript-hub-generator","owner":"vforteli","description":"TypeScript client generator for SignalR Hubs","archived":false,"fork":false,"pushed_at":"2024-11-20T20:09:19.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T02:04:49.418Z","etag":null,"topics":["codegen","dotnet","signalr","typescript","websockets"],"latest_commit_sha":null,"homepage":"","language":"C#","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/vforteli.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-10T17:20:16.000Z","updated_at":"2024-11-20T20:05:21.000Z","dependencies_parsed_at":"2024-11-10T21:19:35.793Z","dependency_job_id":"9f1b96c9-5433-45b8-952c-e21fd385e92c","html_url":"https://github.com/vforteli/dotnet-typescript-hub-generator","commit_stats":null,"previous_names":["vforteli/dotnet-typescript-hub-generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vforteli%2Fdotnet-typescript-hub-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vforteli%2Fdotnet-typescript-hub-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vforteli%2Fdotnet-typescript-hub-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vforteli%2Fdotnet-typescript-hub-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vforteli","download_url":"https://codeload.github.com/vforteli/dotnet-typescript-hub-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137892,"owners_count":21053775,"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":["codegen","dotnet","signalr","typescript","websockets"],"created_at":"2024-11-17T21:44:36.821Z","updated_at":"2026-02-02T12:47:24.243Z","avatar_url":"https://github.com/vforteli.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScriptHubGenerator\n\nCreate TypeScript clients from SignalR hubs.\n\nFor React, a context and hook is created.\n\n# Using the tool\n\n```\n# install globally (or locally)\ndotnet tool install --global vforteli.TypeScriptHubGenerator\n\n# run the tool\ndotnet tshubgen \\\n    --assembly-path \"some/folder/assembly.dll\" \\\n    --output-folder \"some/other/folder\" \\\n     --create-react-context\n```\n\n# Using the client\n\n## React\n\nUsing the client requires installing @microsoft/signalr (tested with version 8.0.7)\n\n```typescript jsx\n// Configure hub in eg App.tsx\nfunction App() {\n  const hubConnection = new HubConnectionBuilder()\n    .withAutomaticReconnect()\n    .withUrl(\"someurl\")\n    .build();\n\n  return (\n    \u003cSomeHubClientContextProvider hubConnection={hubConnection}\u003e\n      \u003c\u003e...\u003c/\u003e\n    \u003c/SomeHubClientContextProvider\u003e\n  );\n}\n```\n\n```typescript jsx\n// Use in some component\nexport const SomeComponent = () =\u003e {\n  const someHub = useSomeHubClient();\n\n  // Wrap in callback to be able to remove handler in useEffect\n  const handleSomethingHappened = useCallback((message: string | null) =\u003e {\n    console.debug(\"hub: \" + message);\n  }, []);\n\n  // Add handler for a callback. The handler must be removed explicitly or duplicates will be added on re-renders\n  useEffect(() =\u003e {\n    someHub.hub.addSomethingHappenedHandler(handleSomethingHappened);\n\n    return () =\u003e {\n      someHub.hub.removeSomethingHappenedHandler(handleSomethingHappened);\n    };\n  }, [handleSomethingHappened, someHub.hub]);\n\n  // Invoke a hub method\n  const doSomething = () =\u003e {\n    someHub.hub.doSomething({ somePayload: \"hello from component!\" });\n  };\n\n  return \u003c\u003e...\u003c/\u003e;\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvforteli%2Fdotnet-typescript-hub-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvforteli%2Fdotnet-typescript-hub-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvforteli%2Fdotnet-typescript-hub-generator/lists"}