2022-10-27 13:34:24 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.SignalR.Client;
|
|
|
|
|
|
|
|
namespace osu.Game.Online
|
|
|
|
{
|
2022-11-02 10:43:22 +08:00
|
|
|
public class HubClient : PersistentEndpointClient
|
2022-10-27 13:34:24 +08:00
|
|
|
{
|
|
|
|
public readonly HubConnection Connection;
|
|
|
|
|
|
|
|
public HubClient(HubConnection connection)
|
|
|
|
{
|
|
|
|
Connection = connection;
|
|
|
|
Connection.Closed += InvokeClosed;
|
|
|
|
}
|
|
|
|
|
2022-11-02 10:44:16 +08:00
|
|
|
public override Task ConnectAsync(CancellationToken cancellationToken) => Connection.StartAsync(cancellationToken);
|
2022-10-27 13:34:24 +08:00
|
|
|
|
|
|
|
public override async ValueTask DisposeAsync()
|
|
|
|
{
|
|
|
|
await base.DisposeAsync().ConfigureAwait(false);
|
|
|
|
await Connection.DisposeAsync().ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|