1、下载WebScoket 服务器类库Fleck.dll 与客户端类库websocket-sharp.dll : https://pan.baidu.com/s/1o9jU22e
2、WebSocket 服务器代码:
1 List allSockets;
2 public void Func()
3 {
4 try
5 {
6 FleckLog.Level = LogLevel.Debug;
7 allSockets = new List();
8
9 var server = new WebSocketServer("ws://0.0.0.0:9999");
10
11 server.Start(socket =>
12 {
13 socket.OnOpen = () =>
14 {
15 allSockets.Add(socket);
16 };
17
18 socket.OnClose = () =>
19 {
20