24 lines
637 B
C#
24 lines
637 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 Connect()
|
|
{
|
|
return _connection;
|
|
}
|
|
}
|
|
} |