mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 17:57:21 +01:00
add config for server transport type
This commit is contained in:
parent
88d0ab2d99
commit
9af89200c8
4 changed files with 41 additions and 3 deletions
|
|
@ -57,13 +57,23 @@ public class HubFactory : MediatorSubscriberBase
|
|||
|
||||
private HubConnection BuildHubConnection(CancellationToken ct)
|
||||
{
|
||||
Logger.LogDebug("Building new HubConnection");
|
||||
var transportType = _serverConfigurationManager.GetTransport() switch
|
||||
{
|
||||
HttpTransportType.None => HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling,
|
||||
HttpTransportType.WebSockets => HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling,
|
||||
HttpTransportType.ServerSentEvents => HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling,
|
||||
HttpTransportType.LongPolling => HttpTransportType.LongPolling,
|
||||
_ => HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling
|
||||
};
|
||||
|
||||
var baseTransport = _serverConfigurationManager.GetTransport();
|
||||
Logger.LogDebug("Building new HubConnection using transport {transport}", baseTransport);
|
||||
|
||||
_instance = new HubConnectionBuilder()
|
||||
.WithUrl(_serverConfigurationManager.CurrentApiUrl + IMareHub.Path, options =>
|
||||
{
|
||||
options.AccessTokenProvider = () => _tokenProvider.GetOrUpdateToken(ct);
|
||||
options.Transports = HttpTransportType.WebSockets | HttpTransportType.ServerSentEvents | HttpTransportType.LongPolling;
|
||||
options.Transports = transportType;
|
||||
})
|
||||
.AddMessagePackProtocol(opt =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue