-
Notifications
You must be signed in to change notification settings - Fork 11
WebSocket
Henry edited this page Oct 11, 2019
·
1 revision
组件提供Websocket 的Client支持,只需要简单地定义对象即可使用。
TextClient client = new TextClient("ws://echo.websocket.org");
以上是定义一个处理文本的WebSocket的client,服务指向ws://echo.websocket.org,组件是支持wss可以根据需要访问相应的wss服务。
组件不需要显式打开连接,内部会对连接进行检测和重连。
client.DataReceive += (o, e)=>{
Console.WriteLine(e.Message);
};
await client.Send("hello");
var result = await client.ReceiveFrom("hello");