How to access http headers in Phoenix socket?

About the part “otherwise you just disconnect them”, do you have any ideas on how to implement it? I’m assuming you meant “disconnect if the user doesn’t authenticate in X seconds”.

What I have tried

In the user socket’s connect/3

  1. Schedule an :auth_timeout message using Process.send_after/3 to self()
  2. Save the timer reference into the socket assigns
  3. Handle the :auth_timeout and disconnects the socket.

In the user channel’s join/3

  1. Cancel the timer once the user authenticates.

However, Phoenix.Socket brings its own handle_info(message, state) that matches everything. So instead of sending my custom :auth_timeout, I tried sending a %Broadcast{event: "disconnect"} that I see in the source code. However, it looks the process that runs the connect/3 is not the same that would be listening for these messages, so nothing happens.

Do you know which process would it be?