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

Can this handle channel subscribing like Phoenix js #110

Open
Cookiezzz opened this issue May 6, 2022 · 1 comment
Open

Can this handle channel subscribing like Phoenix js #110

Cookiezzz opened this issue May 6, 2022 · 1 comment

Comments

@Cookiezzz
Copy link

Cookiezzz commented May 6, 2022

Hi there.
Awesome library. Use it for a simple websocket and works great!
Now I see in the help files you talk about channels and subscribing but I don't see the actual way on how to.
Is it possible to subscribe to channels in a web socket like Phoenix does?
https://hexdocs.pm/phoenix/js/index.html

@marek-petak
Copy link

yes you can.

async Task JoinChannel(ClientWebSocket webSocket, string channelName)
{
    string joinMessage = $"{{\"topic\":\"{channelName}\",\"event\":\"phx_join\",\"payload\":{{}},\"ref\":\"1\"}}";

    await SendMessage(webSocket, joinMessage);
}

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

2 participants