@@ -46,6 +46,26 @@ builder.UseWolverine(opts =>
4646 // for the WolverineHub
4747 o .ClientTimeoutInterval = 10 .Seconds ();
4848 });
49+
50+ // Instead of self-hosting, it's also possible to
51+ // use Azure SignalR. Only one of the two SignalR
52+ // registrations are necessary. Both register the
53+ // required services in DI
54+ opts .UseAzureSignalR (hub =>
55+ {
56+ // Optionally configure the SignalR HubOptions
57+ // for the WolverineHub
58+ hub .ClientTimeoutInterval = 10 .Seconds ();
59+ }, service =>
60+ {
61+ // And optionally configure the Azure SignalR
62+ // options for the connection.
63+ service .ApplicationName = " wolverine" ;
64+
65+ // You probably want one of these from your
66+ // configuration somehow
67+ service .ConnectionString = " Endpoint=https://myresource.service.signalr.net;AccessKey=...;Version=1.0;" ;
68+ });
4969
5070 // Using explicit routing to send specific
5171 // messages to SignalR
@@ -59,7 +79,7 @@ builder.UseWolverine(opts =>
5979 });
6080});
6181```
62- <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Samples/WolverineChat/Program.cs#L12-L39 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_configuring_signalr_on_server_side ' title =' Start of snippet ' >anchor</a ></sup >
82+ <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Samples/WolverineChat/Program.cs#L12-L59 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_configuring_signalr_on_server_side ' title =' Start of snippet ' >anchor</a ></sup >
6383<!-- endSnippet -->
6484
6585That handles the Wolverine configuration and the SignalR service registrations, but you will also need to map
@@ -84,7 +104,7 @@ app.MapWolverineSignalRHub("/api/messages");
84104
85105return await app .RunJasperFxCommands (args );
86106```
87- <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Samples/WolverineChat/Program.cs#L43-L61 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_using_map_wolverine_signalrhub ' title =' Start of snippet ' >anchor</a ></sup >
107+ <sup ><a href =' https://github.com/JasperFx/wolverine/blob/main/src/Samples/WolverineChat/Program.cs#L63-L81 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-sample_using_map_wolverine_signalrhub ' title =' Start of snippet ' >anchor</a ></sup >
88108<!-- endSnippet -->
89109
90110## Messages and Serialization
0 commit comments