-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(peer): add close and terminate #36
base: main
Are you sure you want to change the base?
Conversation
I'm unsure if this is the desired direction, and I haven't tested the different implementations, only Node. Feel free to push any changes you wish |
@@ -108,4 +108,15 @@ class CloudflarePeer extends Peer<{ | |||
this.ctx.cloudflare.server.send(toBufferLike(message)); | |||
return 0; | |||
} | |||
|
|||
close(code?: number, reason?: string) { | |||
this.ctx.cloudflare.client.close(code, reason); |
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.
I'm not familiar with Cloudflare websockets and having two of them so this could be wrong
* @param code The close code to send | ||
* @param reason The close reason to send | ||
*/ | ||
abstract close(code?: number, reason?: string): void; |
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.
What do you think to support it as { code?: number, reason?: string, terminate?: boolean }
to keep simility? (also many providers might not respect terminate
and behave it same as close)
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.
It's up to you. Given that termination seems to send a specific code, having a direct helper seems to be more appropriate. Most providers seem to have it. When searching online for the feature I found both close()
and terminate()
, so I would say it's more intuitive to have two distinct methods than one with an extra argument at the very end
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.
okay, thanks for context. let me research little more when could to decide.
π Linked issue
Close #23
β Type of change
π Description
π Checklist