Skip to content
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

stream close: reason and codes #6

Closed
MeirionHughes opened this issue Dec 29, 2019 · 1 comment
Closed

stream close: reason and codes #6

MeirionHughes opened this issue Dec 29, 2019 · 1 comment
Assignees

Comments

@MeirionHughes
Copy link

quick question for some specifics: so the connection resolves to {readable, writable}

ReadableStream has a close(reason?) and,
WritableStream has an abort(reason?), and its Writer also has closeandabort`

do these effect the websocket? if so,
when close(), with/without reason, what websocket code is sent?
when abort(), with/without reason, what websocket code is sent?
when writer.abort(), with/without reason, what websocket code is sent?

cheers

@ricea ricea self-assigned this Jan 6, 2020
@ricea
Copy link
Owner

ricea commented Jan 6, 2020

These do affect the WebSocket. I should clarify this in the explainer.

close() closes with an "unspecified" code, ie. the Close frame has no body.
abort() closed with an unspecified code by default, but you can use abort({code, reason}) to send a specific code and reason. For example, abort({code: 4000, reason: 'my reason'}) will close with status code 4000 and reason my reason. I'm not 100% confident that this is the right behaviour, but it is what Chromium implements.
writer.close() and writer.abort() behave the same as the same methods on the WritableStream.
cancel() on the ReadableStream behaves like abort(), as does reader.cancel().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants