Good tutorials for phoenix channels

I checked google. But Most of them about a simple chat app. If you have some good advices about phoenix channels can you please post ?

Which questions do you have about it? https://hexdocs.pm/phoenix/channels.html#content does a pretty good job at explaining both public and private channels.

2 Likes

Actullly my questions are not fully about phoenix channels. I want to implement a in app notfication system. I want to see different style use case of phoenix channels. I have not much of web experience so that makes stuck my programing imagination

1 Like

I have not much of web experience, so that makes stuck my programming imagination

Perhaps it would be a good idea to start out by creating a web application first?

Implementing a notification system don’t have to be very different from chat rooms. Channels are just rooms that are either private or publicly accessible. A user subscribe to a private channel (for example "notifications:#{user_id}) for user-specific notifications and a public for global notifications (for example “notifications:global”. The server broadcasts to these channels when necessary.

I would recommend picking up https://pragprog.com/book/phoenix/programming-phoenix. It’s a great walkthrough of the different parts of web application development in Elixir.

1 Like

Yes i know channel part. Problem is notifications will be on every page. So I need to fetch them from databese. Is best way fetching notifications with json ?

Technically it is more efficient to bake it in on the first page load, but that would slow down initial rendering by a millisecond or so if that matters. :slight_smile:

1 Like

Great ms is not necessary but i like that idea i want make it real. How can i apply that. Where should i store notifications?

Depends on your model, I’d probably store it in a prebuilt javascript structure in the site as it is the smallest bit and use the same javascript that would render the notifications to render that first.

1 Like