mirror of
https://github.com/timi137137/AuroraNative.git
synced 2025-09-22 07:46:01 +00:00
03/11 Last Update
This commit is contained in:
@@ -41,15 +41,19 @@ namespace AuroraNative.WebSockets
|
||||
/// <summary>
|
||||
/// 创建并连接到WebSocket服务器
|
||||
/// </summary>
|
||||
public void Create()
|
||||
public bool Create()
|
||||
{
|
||||
WebSocket = new ClientWebSocket();
|
||||
Task Connect = ((ClientWebSocket)WebSocket).ConnectAsync(new Uri("ws://" + Host + "/"), CancellationToken.None);
|
||||
Connect.Wait();
|
||||
if (WebSocket.State == WebSocketState.Open)
|
||||
{
|
||||
Task.Run(Feedback);
|
||||
if (WebSocket is ClientWebSocket socket) {
|
||||
Task Connect = socket.ConnectAsync(new Uri("ws://" + Host + "/"), CancellationToken.None);
|
||||
Connect.Wait();
|
||||
if (WebSocket.State == WebSocketState.Open)
|
||||
{
|
||||
Task.Run(Feedback);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user