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

Provide access to WebSocket header when connecting to Pheonix Socket #44

Closed
mehrdad-shokri opened this issue Nov 22, 2021 · 3 comments
Closed

Comments

@mehrdad-shokri
Copy link

mehrdad-shokri commented Nov 22, 2021

Here you are calling connect on WebSocketChannel

_ws = WebSocketChannel.connect(_mountPoint);

Please provide a Map<String, String> headers on the constructor of PhoenixSocket so we can pass our authentication cookies to the server.

@Pacane
Copy link

Pacane commented Nov 22, 2021

Would you mind opening a PR? I'd be glad to review it.

Thank you!

@mehrdad-shokri
Copy link
Author

Sure, will do in the following days

@RodolfoSilva
Copy link

@mehrdad-shokri @Pacane

I think this solves your problem. This feature was added in this PR: #71

return PhoenixSocket(
     "ws://localhost:4000/socket",
      webSocketChannelFactory: (uri) {
        return IOWebSocketChannel.connect(uri, headers: { "token": "My Token"});
      },
    );

@matehat - I think this issue is resolved.

@matehat matehat closed this as completed Apr 9, 2024
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

No branches or pull requests

4 participants