-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that was a rework indeed.
LGTM, maybe adding coverage tracking would help as it definitely needs lot of more testing to find runtime issues.
frame.opcode = (opcode).Opcode | ||
if frame.length > 125: | ||
raise newException(WSPayloadTooLarge, | ||
"Control message payload is freater than 125 bytes!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: greater
This should be ready for review. As it is, it still lacks comprehensive tests, but it is a fully functional implementation with browser interop. The next steps are:
|
CI is broken for i386 for github actions here is an issue tracking it - actions/runner-images#2919 (comment). The workaround didn't work, but it's not critical to merge. |
This is a minimal functional implementation that reworks:
proc recv*(ws: WebSocket, data: pointer, size: int): Future[int] {.async.}
, allows passing a pointer to up tosize
bytes, note that this will potentially consume multiple and/or partial frames. This will consume a frame as soon as it arrives, without buffering, which allows streaming.proc recv*(ws: WebSocket, size = WSMaxMessageSize): Future[seq[byte]] {.async.}
a convenience method that accumulates frames up to a max message sizefin
flagThis PR does not address any of the HTTP handling functionality already present, which is largely based on the
nim-json-rpc
implementation but should potentially be reworked with the new HTTP functionality recently added to chronos.