I am looking to incrementally port over a legacy API application to Phoenix. Ideally, I would carve out the subdomains of my application into separate Phoenix apps and host them on different server nodes.
I am hoping to use Phoenix channels to facilitate app to app communication. How do I connect one Phoenix app to another's channels and topics? For example, I would like to set up a 'jobs.foo.com' subdomain with WebSockets like:
socket "/ws", Jobs do
channel "jobs:work_orders", WorkOrdersChannel
end
From another Phoenix app (ex: Reports) I would like to pub/sub to that Jobs channel topic. Would it be advisable to create a Phoenix.Endpoint
Jobs lib, in Reports, and configure that Jobs.Endpoint
url in config.exs? Could I then make use of something like Phoenix.PubSub.subscribe/4
with that named pubsub endpoint?
I am not sure if what I am thinking makes sense. If there is a more advisable approach, I am open to suggestion.
-- EDIT --
Just to clarify what I am trying to accomplish ... I am wanting to make one Phoenix app connect to another via a WebSocket client. That will allow me to have apps, with different domain logic, communicate via events over channels and topics of common interest.