Squirrowse/Squirrowse.Client/Service/ConnectionManager.cs

22 lines
614 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();
2019-11-01 19:04:24 +01:00
}
2019-11-01 19:04:24 +01:00
public HubConnection Connect() => _connection;
}
}