21 lines
616 B
C#
21 lines
616 B
C#
|
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;
|
|||
|
}
|
|||
|
}
|