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

Add support for websocket connection cancellation via Shutdown() method #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ttjiaa
Copy link
Contributor

@ttjiaa ttjiaa commented Jul 20, 2018

This PR adds support for closing of proxied websocket connections via a Shutdown(ctx context.Context) error method.

This is useful in the case where the service handling the proxied connections is shutting down, and we want to gracefully disconnect the websocket connections.

@ttjiaa ttjiaa force-pushed the add-cancellation branch 2 times, most recently from 1a532b7 to 10ab726 Compare July 23, 2018 19:34
@ttjiaa ttjiaa changed the title Add support for websocket connection cancellation Add support for websocket connection cancellation via Shutdown() method Jul 24, 2018
@@ -121,4 +122,6 @@ func TestProxy(t *testing.T) {
if msg != string(p) {
t.Errorf("expecting: %s, got: %s", msg, string(p))
}

proxy.Shutdown(context.Background())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to test the going away close message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, PTAL

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

Successfully merging this pull request may close these issues.

None yet

3 participants