Is it possible to subscribe the socket to some Phoenix channels on the backend and not from the client? Let's say I have some groups to which user belongs, and I want user to connect to them once WS connection is established. Sending ids of groups to the user and joining channels seems like an unnecessary roundtrip, especially that I'd like to handle messages in that groups in one callback, so I'd use onMessage on Socket and match by the mask. How would I do that?
Subscribe to Phoenix Channel on the backend (not channel.join())
402 Views Asked by Ivan Yurov At
2
There are 2 best solutions below
0
Apoorv-2204
On
Maybe this can help. https://www.erlang.org/doc/man/gen_tcp.html
{ok, Socket} = gen_tcp:connect(host/addr, port,[binary/list, {packet, 2}])
Related Questions in SOCKETS
- Drawing with ncurses, sockets and fork
- UDP sockets in C not working
- How can I send multiple objects over one socket in java?
- psuedo TCP multicast with os.dup2() in python?
- My get request for http is very slow
- Nodejs connect mysql socket to another host?
- HttpRequestContext vs HttpContext
- Spring based client server communication without network
- Java does not accept 2 methods with same name
- Retrieve Data From EOC(Eithernet Over coxial) device
- Ping a server without freezing the Thread
- C sockets: Exit client after all data is received
- What is the best way to send XML converted to a byte array over TCP, then translate the response back to readable XML?
- C# Winform to Connect to Device Using IP
- Java Restart a Socket
Related Questions in WEBSOCKET
- How to send raw data using socket.io
- HttpRequestContext vs HttpContext
- Websocket support on JBoss 6
- How to send/receive messages through a web socket on windows phone 8.1
- Stop receiving an event for some time in socket io
- Nginx not passing websocket upgrade response back to client?
- Jboss showing this error in eclipse
- Oauth in Tyrus WebSocket
- Meteor: Workaround for having websockets blocked in port 80?
- Python Server - Processing WebSocket.close()
- Multithread using Executor and WebSocket
- Start Rumpetroll on Debian
- What are the possible bugs that cause slow response (sometimes but not all the time) for a websocket connection?
- Ratchet websocket server not responding after some hour
- Angularjs data is not updated on call of $apply
Related Questions in ELIXIR
- Multiline comment in Elixir
- Output tabular data with IO.ANSI
- Does Elixir have coding standards or an authoritative style guide published by the language developers, like PEP8 or the Erlang Programming Rules?
- Check if a URL is valid in elixir
- Elixir exrm release crashes on eredis start_link
- Writing a library that works for BitStrings or Lists
- Elixir exrm console works but application does not start automatically
- Why do I receive a FunctionClauseError ("no function clause matching") in this Elixir program, translated from Erlang?
- Expect-like functionality to IO.gets?
- How to stub (or prevent running) of a call to a worker in my ExUnit test?
- Is Elixir's System.cmd blocking
- Elixir - Nested JSON parsing to structs
- What is the number that shows up after you define an anonymous function in elixir?
- Using System.cmd within a Poolboy worker (gen_server) causes silent failure
- How Can We Clear the Screen in Iex on Windows
Related Questions in PHOENIX-FRAMEWORK
- How to stub (or prevent running) of a call to a worker in my ExUnit test?
- Using System.cmd within a Poolboy worker (gen_server) causes silent failure
- Rails' before_filter equivalent in Phoenix
- How to Log something in Controller when Phoenix Server is running?
- Select Field in Phoenix Templates
- How to delete a Phoenix Session?
- Plug.Conn.assign not working when called from a Pipeline Plug
- Where can I put my Plugs and then use them from different controllers in my Phoenix app?
- How to get a variable value from Environment files in Phoenix?
- full text search for phoenix framework
- Print the record count using Phoenix/Ecto from the terminal
- In a Phoenix application, what is the difference between the :port key of the :http and :url configurations?
- Elixir/Phoenix multiple applications on same machine
- Using Elixir Plug.conn.assigns in multiple modules
- How to populate a database in Phoenix/Elixir on a server?
Related Questions in PHOENIX-CHANNELS
- Elixir/Phoenix Endpoint broadcast from another module
- Elixir Phoenix Restful to websocket API
- How can I get Phoenix to join channels automatically when a client connects?
- How to broadcast to one socket_id using phoenix
- Count open socket and channel connections in a Phoenix application
- Phoenix Channel can't maintain connection with frontend once the connection is established (Error during WebSocket handshake)
- How to setup a phoenix channel for say hundreds of topics?
- Connecting remote client to Phoenix channel
- Phoenix application on a fleet of machines
- Phoenix 1.4.0-dev generated channel test fails with compile error
- Is there any way to call controller method from phoenix channel to and fro
- How to test handle_info/2 in Phoenix LiveView?
- How to keep my Android app connected to the backend channel to receive updates and trigger events in device?
- how can i access data inside map in elixir
- When to use {:noreply, socket} vs {:reply, :ok, socket} in a Phoenix Channel?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Not sure if this is a good solution, probably it uses some internal APIs which are not private though: