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

Implement WebSocket support based on Plug.Conn.Adapter.upgrade/3 #38

Merged
merged 20 commits into from
Nov 1, 2022

Conversation

mtrudel
Copy link
Owner

@mtrudel mtrudel commented Oct 16, 2022

This PR provides support for upgrading HTTP connections to WebSocket connections by use of the c:Plug.Conn.Adapter.upgrade/3 callback. WebSocket implementations are called based on the Sock API (which mirrors Phoenix.Socket.Transport) . This work is the Bandit analog of elixir-plug/plug#1119

See phoenixframework/phoenix#5003 for an omnibus overview of the larger body of work that this PR is part of.

@mtrudel
Copy link
Owner Author

mtrudel commented Oct 16, 2022

@moogle19 - would you be able to take a look at this in the context of phoenixframework/phoenix#5003?

Copy link
Contributor

@moogle19 moogle19 left a comment

Choose a reason for hiding this comment

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

Apart from a few cosmetic changes this looks awesome! 🙂

lib/bandit/websocket/socket.ex Outdated Show resolved Hide resolved
lib/bandit/websocket/handler.ex Outdated Show resolved Hide resolved
lib/bandit/websocket/connection.ex Show resolved Hide resolved
@mtrudel
Copy link
Owner Author

mtrudel commented Oct 17, 2022

Thanks for the review @moogle19 !

@mtrudel mtrudel changed the title Implement WebSocket support based on Plug.Conn.Adapter.upgrade/3 and Sock Implement WebSocket support based on Plug.Conn.Adapter.upgrade/3 Nov 1, 2022
@mtrudel mtrudel merged commit 3983e9d into main Nov 1, 2022
@mtrudel mtrudel deleted the sock_3_support branch November 1, 2022 19:41
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

2 participants