Closed baransu closed 7 years ago
100% agree with your proposition 👍 As also discussed before, we would also need mutliple WebSocket connections for that, which is fine for now. Last question I have: right now I can see that we can register handlers using on
function exported from sockets.js
. How would we do that in a clean way using multiple connections? I can't think of a nice way to achieve that (probably due to my lack of JS knowledge) and would really appreciate your help in that matter.
Right now it's more hack than proper solution. I'm thinking about some kind of composition. Every plugin would provide it's own WebSocket handler. It will create new connection and set listeners. Then if more than one plugin is listening for given WebSocket and given topic it will be concatenated into one to create only one connection per route and one listener per topic.
Would you be ale to set up some foundation for that? I don't want to ruin your code, because it's really well written (I can understand JS!)
@arkgil Checkout this PR https://github.com/erlanglab/erlangpl-ui/pull/11
We had discussion with @arkgil about
erlangpl
anderlangpl-ui
structure, how to manage server/client side code of plugins.As follow-up to this discussion we have to change project structure to make it pluggable. Right now we have 3 default plugins:
epl-dashboard
-/home
routevizceral-thingy
-/traffic
routeepl-sub-tree
- new routeEach plugin should export React component, reducer and socket listeners. Whole part will be connected together within main project to keep data management centralised.
Possible solutions:
babel
, and it forces to publish to npm. I want to avoid that right now.src
(due to CRA imports restricted tosrc
)babel
build for every plugin but, as well as glob copy of allcss
files. Solution to this could be nwbSince we are not creating proper plugin system right now, I'm leaning towards second option because it require no setup and just works. Later on, designing proper plugin system, we can think about easy way for creating external plugins in both React and Elm.
/ cc @arkgil