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 on-close handler for websockets. #2612

Merged
merged 2 commits into from
Apr 8, 2023

Conversation

szgupta
Copy link
Contributor

@szgupta szgupta commented Apr 8, 2023

Summary

When a websocket is closed, it'd be beneficial to have an on-close handler that can be registered to execute teardown logic. This approach is better than spinning up a goroutine and blocking on ctx.Done() (in cases where that's the only other option).

See issue: #2604

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

@coveralls
Copy link

Coverage Status

Coverage: 78.501% (+3.3%) from 75.171% when pulling a0e52b4 on szgupta:suraj/websocket-close-func into 4548815 on 99designs:master.

@StevenACoffman StevenACoffman merged commit 8b38c0e into 99designs:master Apr 8, 2023
@StevenACoffman
Copy link
Collaborator

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants