-
Notifications
You must be signed in to change notification settings - Fork 105
Distribution from browser to host #343
Comments
I’m a bit confused by the hang up on EPMD, with BEAM it is possible to provide your own EPMD backend, this is often used to remove the dependency on EPMD from environments where it is not supported. This combined with a custom distribution transport should allow avoiding EPMD entirely. See epmdless as an example. |
I get you can go without EPMD, but I want to support still having EPMD so that potentially this could run in a normal host project, similar to how Phoenix Live Reload does for Phoenix project and not need to enforce going EPMDless on the entire project. |
I'd like to understand the benefit of supporting EPMD here, at least initially. I'm not super convinced that there is anything to be gained. We definitely can't support remote shells in non-local/non-dev settings (for the browser target), since it would absolutely overwhelm distribution, so the general case of wanting the app to use EPMD in production isn't relevant. So we're really talking specifically about getting a remote shell node to connect via a single host node, to a single client-side node. In that setting we don't have a need for EPMD, and removing it as a requirement involves less moving parts, as far as I can tell. To give you the idea of how I see it working:
The debug node is running the same EPMD backend, but configured to run as a client rather than server. It connects to the NOTE: The invocation of To be clear, I'm not saying your solution isn't viable, or unacceptable, I think it is both; I'm just hoping that there is a simpler solution possible. If what I'm suggesting above isn't simpler, or if there are other reasons it isn't viable or less than ideal, that's fine, I don't see any reason why your proposal isn't viable. |
Note to reassess if the WASM debug support is good enough to replace this effort |
To be able to support the community debugging tools, specifically Observer, we'll need to be able to expose the Lumen runtime running in a browser tab to the host. Because the host wants to connect to nodes it can find by first talking to EPMD, we will need a proxy that shows up as another node on the host, but then gets forwarded to the browser.
lumen_runtime
.This may be the same interface as
net_kernel
or something specific to Lumen using Rustfn
similar to the time source.phoenix_client
to connect to theHOST
Lumen.Web.WebSocket
to connect toHOST
in place ofwebsocket_client
thatphoenix_client
uses by default.Lumen.BeamSplitter
Elixir project that runs on theHOST
socket
, similar to howphoenix_live_reload
is on a separate socket prefix from the app's default onePROXY_PORT
)PROXY_PORT
is another node.PROXY_PORT
to the Phoenix ChannelWith this setup it should be possible for
:observer.start()
launched fromiex -S mix phx.server
onHOST
to then connect to thelocalhost:PROXY_PORT
and talk to the Lumen runtime in the browser tab.Alternatives
net_kernel
onHOST
Overriding
net_kernel
onHOST
so that it natively understand websockets, similar to how other developers have overriddennet_kernel
on Heroku and other restricted environments.Raw WebSockets
Instead of going over Phoenix Channels, we could use a raw websocket. This makes it easier to talk to things that aren't Phoenix, but makes it hard to integrate with Phoenix as we couldn't use the Endpoint
socket
DSL.The text was updated successfully, but these errors were encountered: