/// <summary> /// 消息到达 /// </summary> /// <param name="sender"></param> /// <param name="connId"></param> /// <param name="final"></param> /// <param name="opCode"></param> /// <param name="mask"></param> /// <param name="data"></param> /// <returns></returns> public HandleResult OnMessage(IWebSocketServer sender, IntPtr connId, bool final, OpCode opCode, byte[] mask, byte[] data) { Console.WriteLine($"OnMessage({connId}), final: {final}, op code: {opCode}, data length: {data.Length}"); var ok = sender.Text(connId, $"这里只是一个欢迎页面, 只是欢迎您, 您可以连接到 {(sender.IsSecure ? "wss" : "ws")}://{sender.Uri.Host}:{sender.Uri.Port}/echo"); return(ok ? HandleResult.Ok : HandleResult.Error); }