c#服务端:Fleck
web客户端:web-socket-js
public class SampleHandle : EasyConnectionHandle
{
public override void OnClose()
{
}
public override void OnError(Exception e)
{
}
public override void OnOpen()
{
}
}
EasyWebSocketServer.CreateServer()
.MapHandle<SampleHandle>("/simple")
.WithFlashPoliy()
.Start();
<script src="easy.websocket.js"></script>
<script type="text/javascript">
var websocket = new EasyWebSocket();
websocket.start("ws://127.0.0.1:12345/simple");
websocket.onOpen = function () {
};
websocket.onClose = function () {
};
websocket.onError = function () {
};
</script>