erlanglab / erlangpl-ui

DEPRECATED: UI for Erlang Performance Lab
http://www.erlang.pl/
Apache License 2.0
18 stars 2 forks source link

Make erlangpl-ui pluggable #6

Closed baransu closed 7 years ago

baransu commented 7 years ago

We had discussion with @arkgil about erlangpl and erlangpl-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:

Each 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:

Since 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

arkgil commented 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.

baransu commented 7 years ago

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.

arkgil commented 7 years ago

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!)

baransu commented 7 years ago

@arkgil Checkout this PR https://github.com/erlanglab/erlangpl-ui/pull/11