File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,19 @@ This package implements all public features of SignalR Typescript client.
25
25
26
26
The following snippet shows how to setup the client to send and receive messages using SignalR.
27
27
28
+ The HubConnectionBuilder needs to get injected, which must be registered:
28
29
``` c#
29
- var connection = new HubConnectionBuilder ()
30
+ // in Startup.cs, ConfigureServices()
31
+ services .AddTransient <HubConnectionBuilder >();
32
+ ```
33
+ ``` c#
34
+ // in Component class
35
+ [Inject ]
36
+ private HubConnectionBuilder _hubConnectionBuilder { get ; set ; }
37
+ ```
38
+ ``` c#
39
+ // in Component Initialization code
40
+ var connection = _hubConnectionBuilder // the injected one from above.
30
41
.WithUrl (" /myHub" , // The hub URL. If the Hub is hosted on the server where the blazor is hosted, you can just use the relative path.
31
42
opt =>
32
43
{
You can’t perform that action at this time.
0 commit comments