diff --git a/CSharp-OpenBMCLAPI/Modules/Cluster.cs b/CSharp-OpenBMCLAPI/Modules/Cluster.cs index 1a93512..b9501fb 100644 --- a/CSharp-OpenBMCLAPI/Modules/Cluster.cs +++ b/CSharp-OpenBMCLAPI/Modules/Cluster.cs @@ -37,15 +37,6 @@ public Cluster(ClusterInfo info, TokenManager token) : base() // Fetch 一下以免出现问题 this.token.FetchToken().Wait(); - this.socket = new(HttpRequest.client.BaseAddress?.ToString(), new SocketIOOptions() - { - Transport = SocketIOClient.Transport.TransportProtocol.WebSocket, - Auth = new - { - token = token.Token - } - }); - this.socket.ConnectAsync().Wait(); this.socket.On("error", error => HandleError(error)); @@ -100,6 +91,18 @@ protected async Task AsyncRun() return returns; } + public async Task Connect() + { + this.socket = new(HttpRequest.client.BaseAddress?.ToString(), new SocketIOOptions() + { + Transport = SocketIOClient.Transport.TransportProtocol.WebSocket, + Auth = new + { + token = token.Token.token + } + }); + } + public async Task Enable() { await socket.EmitAsync("enable",