Squirrowse/Squirrowse.Client/Service/ConnectionManager.cs

21 lines
616 B
C#
Raw Normal View History

using Microsoft.AspNetCore.SignalR.Client;
using Microsoft.Extensions.DependencyInjection;
namespace Squirrowse.Client.Service
{
public class ConnectionManager : IConnectionManager
{
private readonly HubConnection _connection;
public ConnectionManager(string url, int port)
{
_connection = new HubConnectionBuilder()
.WithUrl($"{url}:{port}/StreamHub")
.AddMessagePackProtocol()
.WithAutomaticReconnect()
.Build();
}
public HubConnection EstablishHubConnection() => _connection;
}
}