class: center, middle # Channels and Stuff a Stefan talk is currently always about
some aspect of [Panoptikum](https://panoptikum.social) --- # Context * 1.3 (whoop!, whoop!) * api - namespacing (endpoints = ports) * Implementation follows [Programming Phoenix](https://pragprog.com/book/phoenix/programming-phoenix) Book * channels for notifications and toggle buttons * demo! * code walkthrough * Frontend vs. Backend vs. API --- # Code Walkthrough 1/3 ### Template * templates/podcast_frontend/
[_like_follow_unsubscribe_buttons.html.eex](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/templates/podcast_frontend/_like_follow_unsubscribe_buttons.html.eex) ### View * [PanWeb.PodcastFrontendView.like_or_unlike()](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/frontend_views/podcast_frontend_view.ex#L37) but we will also need later * [PanWeb.PodcastFrontendView.render "like_button.html"](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/frontend_views/podcast_frontend_view.ex#L21) --- # Code Walkthrough 2/3 ### Javascript * [Podcast](https://github.com/PanoptikumIO/pan/blob/master/assets/js/podcast.js) * [Mailbox](https://github.com/PanoptikumIO/pan/blob/master/assets/js/mailbox.js) ### Channels * [PanWeb.PodcastChannel.handle(like, ...)](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/channels/podcast_channel.ex#L12) * [PanWeb.UserSocket, channel "podcasts:*"](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/channels/user_socket.ex#L8) --- # Code Walkthrough 2/3 ### ~~Models~~ Modules * [PanWeb.Podcast.like()](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/models/podcast.ex#L68) * [PanWeb.Message.persist_event()](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/models/message.ex#L26) * [PanWeb.Event.notify_subscribers()](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/models/event.ex#L24) ### and from the Api * [PanWeb.Api.LikeController.toggle()](https://github.com/PanoptikumIO/pan/blob/master/lib/pan_web/api/controllers/like_controller.ex#L168)