Example #1
0
        /// <inheritdoc />
        public override bool AcceptOutboundMessage(object msg)
        {
            if (!(msg is WebSocketFrame wsFrame))
            {
                return(false);
            }

            if (ExtensionEncoderFilter.MustSkip(wsFrame))
            {
                if (_compressing)
                {
                    ThrowHelper.ThrowInvalidOperationException_Cannot_skip_per_message_deflate_encoder();
                }
                return(false);
            }

            switch (wsFrame.Opcode)
            {
            case Opcode.Text:
            case Opcode.Binary:
                return(0u >= (uint)(wsFrame.Rsv & WebSocketRsv.Rsv1));

            case Opcode.Cont:
                return(_compressing);

            default:
                return(false);
            }
        }
Example #2
0
        /// <inheritdoc />
        public override bool AcceptOutboundMessage(object msg)
        {
            if (!(msg is WebSocketFrame wsFrame))
            {
                return(false);
            }

            if (ExtensionEncoderFilter.MustSkip(wsFrame))
            {
                return(false);
            }

            switch (wsFrame.Opcode)
            {
            case Opcode.Text:
            case Opcode.Binary:
            case Opcode.Cont:
                return((uint)wsFrame.Content.ReadableBytes > 0u && 0u >= (uint)(wsFrame.Rsv & WebSocketRsv.Rsv1));

            default:
                return(false);
            }
        }