-
Notifications
You must be signed in to change notification settings - Fork 3k
Phoenix.Router based socket routing #6142
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
base: main
Are you sure you want to change the base?
Conversation
@@ -1060,11 +942,11 @@ defmodule Phoenix.Endpoint do | |||
by `Phoenix.Token`. By default tokens are valid for 2 weeks | |||
|
|||
""" | |||
defmacro socket(path, module, opts \\ []) do | |||
module = Macro.expand(module, %{__CALLER__ | function: {:socket_dispatch, 2}}) | |||
defmacro socket(_path, _module, _opts \\ []) do |
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.
We most likely want to still support the old way as usual
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.
Yeah, I removed stuff in here mostly to make sure I catch everything. Making this propely backwards compatibility preserving will make sense once other questions are dealt with.
lib/phoenix/endpoint.ex
Outdated
def __start_sockets__ do | ||
unquote(Keyword.get(opts, :start_sockets, [])) | ||
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.
I don't know yet if I really like having it explicit.
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.
Yeah, I'm with you. On the one hand it is really nice how this used to work.
On the other hand I don't like the amount of stuff that's being configured on the endpoint socket macro. Because there's just a single entry point to "everything" that also means everything needs to somehow be configured right there.
Given routers and endpoints are really only quite loosely coupled there's afaik also no good way to retain the static knowledge of to be started socket modules from the router macro.
d364e18
to
d6a715d
Compare
62c4c2c
to
0e0c2d7
Compare
No description provided.