{"id":19746580,"url":"https://github.com/xevilmaxx/blazorserverpushsignalr","last_synced_at":"2026-05-07T05:37:20.639Z","repository":{"id":144156028,"uuid":"382301577","full_name":"xevilmaxx/BlazorServerPushSignalr","owner":"xevilmaxx","description":"Sample of how to use Blazor + SignalR tech (C# Net 5.0). Mainly how to have a static object to use in any place server side in order to push signalR notification to connected clients.","archived":false,"fork":false,"pushed_at":"2021-07-02T10:10:36.000Z","size":335,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T12:36:28.004Z","etag":null,"topics":["aspnet","aspnetcore","blazor","csharp","css","html","linux","net5","razor","signalr"],"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/xevilmaxx.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":"2021-07-02T09:48:33.000Z","updated_at":"2021-08-31T08:51:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"031159d7-a1db-40d3-966e-baa7a5d383bd","html_url":"https://github.com/xevilmaxx/BlazorServerPushSignalr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xevilmaxx/BlazorServerPushSignalr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xevilmaxx%2FBlazorServerPushSignalr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xevilmaxx%2FBlazorServerPushSignalr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xevilmaxx%2FBlazorServerPushSignalr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xevilmaxx%2FBlazorServerPushSignalr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xevilmaxx","download_url":"https://codeload.github.com/xevilmaxx/BlazorServerPushSignalr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xevilmaxx%2FBlazorServerPushSignalr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273672151,"owners_count":25147490,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["aspnet","aspnetcore","blazor","csharp","css","html","linux","net5","razor","signalr"],"created_at":"2024-11-12T02:14:54.736Z","updated_at":"2026-05-07T05:37:15.607Z","avatar_url":"https://github.com/xevilmaxx.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlazorServerPushSignalr\nSample of how to use Blazor + SignalR tech (C# Net 5.0). Mainly how to have a static object to use in any place server side in order to push signalR notification to connected clients.\n\n## Solution based on:\n- - -\nhttps://newbedev.com/how-to-get-signalr-hub-context-in-a-asp-net-core\n- - -\nhttps://stackoverflow.com/questions/51968201/invoking-signalr-hub-not-working-for-asp-net-core-web-api/51981886#51981886\n- - -\n\n### I assume you know how Blazor app is basically structured\n\n### Main Points to focalize on:\n- [x] Startup.cs\n- [x] Hubs/SignalrHub0.cs\n- [x] Pages/Index.razor\n- [x] Controllers/IndexController.cs\n- [x] Statics/SignalrServerSide.cs\n\n### Basic Idea:\n- - -\nYou have your Index.razor (layout only)\n**Index.razor** is controlled by **IndexController.cs**\n\n\n### Basic Workflow\n\n- - -\n\nIn **Startup.cs** you will map your Hub (**SignalrHub0.cs**) on certain endpoint.\n\nBackend of startup will automatically call constructor of **SignalrHub0.cs** with needed data.\n\n- - -\n\nYou will also need to define a Hosted Service (**SignalrServerSide.cs**) which we will use later as main endpoint to access HubClients at any point directly from backend.\n\nAgain, **Startup.cs** backend will keep updated static variable in SignalrServerSide.cs with its strange logics.\n\n- - -\n\nNow all you need to do to get all currently connected clients at any point on server side:\n\n**SignalrServerSide.HubContext**\n\n- - -\n\nIf you wish to recycle logics you already defined in SignalrHub0.cs\n\nThanks to its constructor you can simply do this:\n\n**_ = new SignalrHub0(SignalrServerSide.HubContext).SendMessageAsync(\"MyRecycledMessage\");**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxevilmaxx%2Fblazorserverpushsignalr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxevilmaxx%2Fblazorserverpushsignalr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxevilmaxx%2Fblazorserverpushsignalr/lists"}