diff --git a/GameFrameX.NetWork/BaseNetWorkChannel.cs b/GameFrameX.NetWork/BaseNetWorkChannel.cs index 2c4db8bc..9865ea63 100644 --- a/GameFrameX.NetWork/BaseNetWorkChannel.cs +++ b/GameFrameX.NetWork/BaseNetWorkChannel.cs @@ -73,12 +73,9 @@ public virtual async Task WriteAsync(IMessage messageObject, int uniId = 0, int var messageData = _messageEncoder.Handler(messageObject); - if (IsWebSocket) + if (IsWebSocket && AppSession is WebSocketSession webSocketSession) { - if (AppSession is WebSocketSession webSocketSession) - { - await webSocketSession.SendAsync(messageData); - } + await webSocketSession.SendAsync(messageData); } else {