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>
|
/// <summary>
|
||||||
/// 创建并连接到WebSocket服务器
|
/// 创建并连接到WebSocket服务器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Create()
|
public bool Create()
|
||||||
{
|
{
|
||||||
WebSocket = new ClientWebSocket();
|
WebSocket = new ClientWebSocket();
|
||||||
Task Connect = ((ClientWebSocket)WebSocket).ConnectAsync(new Uri("ws://" + Host + "/"), CancellationToken.None);
|
if (WebSocket is ClientWebSocket socket) {
|
||||||
Connect.Wait();
|
Task Connect = socket.ConnectAsync(new Uri("ws://" + Host + "/"), CancellationToken.None);
|
||||||
if (WebSocket.State == WebSocketState.Open)
|
Connect.Wait();
|
||||||
{
|
if (WebSocket.State == WebSocketState.Open)
|
||||||
Task.Run(Feedback);
|
{
|
||||||
|
Task.Run(Feedback);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user