| 907 | } |
| 908 | |
| 909 | Result HttpWebSocketFrameWriter::writePayload(Span<char> payload) |
| 910 | { |
| 911 | SC_TRY_MSG(frameInProgress, "HttpWebSocketFrameWriter no frame in progress"); |
| 912 | SC_TRY_MSG(payload.sizeInBytes() <= payloadBytesRemaining, |
| 913 | "HttpWebSocketFrameWriter payload exceeds declared frame length"); |
| 914 | |
| 915 | if (currentFrame.masked and not payload.empty()) |
| 916 | { |
| 917 | scHttpWebSocketApplyMask(payload, currentFrame.maskKey, payloadBytesWritten); |
| 918 | } |
| 919 | |
| 920 | payloadBytesWritten += payload.sizeInBytes(); |
| 921 | payloadBytesRemaining -= payload.sizeInBytes(); |
| 922 | return Result(true); |
| 923 | } |
| 924 | |
| 925 | Result HttpWebSocketFrameWriter::finishFrame() |
| 926 | { |