File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/c#/GeneralUpdate.ClientCore/Hubs Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,22 @@ namespace GeneralUpdate.ClientCore.Hubs;
88/// Upgrade the push notification service.
99/// </summary>
1010/// <param name="url">Subscription address, for example: http://127.0.0.1/UpgradeHub</param>
11- public class UpgradeHubService ( string url ) : IUpgradeHubService
11+ /// <param name="token">ID4 authentication token string.</param>
12+ /// <param name="args">Parameters to be sent to the server upon connection (recommended as a JSON string).</param>
13+ public class UpgradeHubService ( string url , string ? token = null , string ? args = null ) : IUpgradeHubService
1214{
1315 private const string Onlineflag = "Online" ;
1416 private const string ReceiveMessageflag = "ReceiveMessage" ;
1517
1618 private readonly HubConnection ? _connection = new HubConnectionBuilder ( )
17- . WithUrl ( url )
19+ . WithUrl ( url , config =>
20+ {
21+ if ( ! string . IsNullOrWhiteSpace ( token ) )
22+ config . AccessTokenProvider = ( ) => Task . FromResult ( token ) ;
23+
24+ if ( ! string . IsNullOrWhiteSpace ( args ) )
25+ config . Headers . Add ( "client" , args ) ;
26+ } )
1827 . WithAutomaticReconnect ( new RandomRetryPolicy ( ) )
1928 . Build ( ) ;
2029
You can’t perform that action at this time.
0 commit comments