Questions tagged [phoenix-channels]

Phoenix framework's channels give the tools to organize the code and the communication among users while keeping the connection opened for live messages updates, its transportation-agnostic, so it can use different protocols, like websocket or log polling..

A Phoenix channel is a conversation. The channel sends messages, receives messages, and keeps state. We call the messages events, and we put the state in a struct called socket. A Phoenix conversation is about a topic, and it maps onto application concepts like a chat room, a local map, a game, or in our case, the annotations on a video. More than one user might be interested in the same topic at the same time. Channels give you tools to organize your code and the communication among users. The concept that makes channels so powerful in Elixir is that each user’s conversation on a topic has its own isolated, dedicated process.

102 questions
0
votes
1 answer

Phoenix, using sockets and Presence outside socket.js, in templates eex

I want to organize the use of socket and Presence in a template in my own way. As a newbie, it seems to me that putting all the client code that deals with channels in sockets.js can convert it into a very large piece. Especially if there are many…
0
votes
1 answer

Phoenix 1.4.0-dev generated channel test fails with compile error

I am developing a web app with the Phoenix framework in a Docker container. Here are the relevant lines in the dockerfile for how phoenix is getting installed: RUN git clone https://github.com/phoenixframework/phoenix RUN cd…
javier
  • 21
  • 1
  • 5
0
votes
1 answer

Phoenix application on a fleet of machines

I'm developing a real-time Phoenix App using it's Channel and Socket modules. The App consists of a few processes and GenServers. I have a use case, where on an event (which is an API call from a microservice), I need to broadcast messages to all…
0
votes
1 answer

How safe and idiomatic would be to use phoenix channels for unauthenticated users instead of ajax

A little context and use case: I have this phoenix app that allows authenticated users to search in database, to retrieve public data. The unauthenticated users use ajax calls and routes to trigger controller and send back a json response to have…
powerbit
  • 39
  • 1
  • 6
0
votes
1 answer

Track presence on UserSocket

I am trying to track the presence of a user on the UserSocker using Phoenix.Presence without the need for the client to be present on a specific channel. Later on I want to subscribe to the presence of a user in different channels to be informed…
goodkat
  • 83
  • 7
0
votes
1 answer

How to setup a phoenix channel for say hundreds of topics?

Suppose there are some users, say 100. Each user has, say 100 items and a percentage of which are shared to the users by other users. Each item has a name. So... What I want is, if I edit the name of item1 of user1, it should update all the users…
abhinav
  • 341
  • 1
  • 4
  • 18
0
votes
0 answers

Elixir reuse channel functionalities when only connected to 1 channel

I have a lot of channels doing different things like the following: starting_channel game_channel food_channel chat_channel And there's maybe 100 of them. Everyone starts by joining starting_channel. Later I can subscribe the socket to other…
Shih-Min Lee
  • 9,350
  • 7
  • 37
  • 67
0
votes
1 answer

Phoenix Presence track users across multiple channels

So I want to keep track of the current room of each user using the presence behavior. The problem is that I can't/don't know how to update the room_id if a user changes its current room. def join("room:" <> room_id, auth_message, socket) do …
Darius
  • 1
  • 1
0
votes
1 answer

Elixir Phoenix Restful to websocket API

RESTful to websocket API question: I want to enable a RESTful api that interfaces with websockets. I have some hardware that maintains a WS connection to my Phx.server, and I would like to allow other clients to hit the phx.server via a RESTful api…
bexley
  • 59
  • 8
0
votes
0 answers

Test an Elixir Monitor Process for Phoenix Channel Close without a timer delay?

I currently have functionality which tracks when a user connects to a channel and when a user leaves a channel. This is implemented from this stackoverflow answer here. I have written the following test (see commit) to verify my callback…
0
votes
0 answers

How to test Phoenix Channel that push result instead of reply?

I have a phoenix channel that does push result on a handle_info after a handle_in instead of replying right away (don't ask why please, I have a use-case). The example below would be similar to my case. def handle_in("topic", %{"param" => param},…
Kunto Fullstack
  • 405
  • 6
  • 16
0
votes
1 answer

How to install SSL Certificate on Centos 7 with Nginx

I've needed to set up SSL on my server, and have been putting it off, I've now done it, and found it a lot simpler than expected, so for anyone else, here's the process I followed. I have a dedicated server, and have downloaded a GeoTrust…
paul h
  • 152
  • 2
  • 10
0
votes
2 answers

passing data from a model/database to a channel using presence

I have a simple chat application that I built and I want to be able to display user uploaded images (locally hosted) next to the user names on the channel's html page. Currently, I am using presence to track the users who are logged into the channel…
Abeltensor
  • 132
  • 1
  • 10
0
votes
1 answer

How to keep a user subscribed to every chat it is following

Thats the messenger's facebook UI If you were implementing that with phoenix (elixir framework) Would you create one phoenix-channel for one chat? Which will implies that you client (mobile, web etc...) will have to open one channel for every chat…
0
votes
1 answer

Error installing cassandra_ecto - Elixer phoenix framework

While installing cassandra_ecto and starting the server, facing some error as ** (Mix) Could not start application cqerl: could not find application file: cqerl.app could not able to proceed after it.
petspanda D
  • 171
  • 2
  • 14