dzintars / front

Test setup (Don't use!) Dev server URL available while i'm developing.
https://front.oswee.dev
1 stars 1 forks source link

Intercept meta-tagged actions and send them over wss #91

Open dzintars opened 4 years ago

dzintars commented 4 years ago

In https://github.com/dzintars/front/commit/4327900973005d115bdb27d726feb0543387288a commit i removed option to automatically intercept meta: { websocket: true} tagged actions. I kinda liked and still like this approach as it requires just to tag relative actions, but at the same time it's somewhat limits the signature of the action signature which is sent to the server. Also by implementing webSocketSend() action it opens doors for more fine grained control. Not sure is it good or not.. will see. Other awkward point is that webSocketSend() expects explicit signature. But there are actions with type only, there could be an actions with type and payload as well. And probably there could be more variations. Mby i need to implement like strict action kind policy. Like "event actions" which contains only the type field. And "command actions" which should contain type and payload fields. Not sure.

Will try to research this point. For now - it is as it is.

dzintars commented 4 years ago

Some resources with similar problems/solutions https://www.reddit.com/r/reactjs/comments/9vjs5n/event_sourcing_in_react_redux_elixir_how_we_write/ https://github.com/giantmachines/redux-websocket https://dev.to/aduranil/how-to-use-websockets-with-redux-a-step-by-step-guide-to-writing-understanding-connecting-socket-middleware-to-your-project-km3 https://petemill.com/writing/redux-saga-realtime-events-channel-deepstream/ https://blog.bitsrc.io/building-a-cqrs-es-app-with-resolve-41f839362ffd Not directly related, but will leave for the history - https://www.youtube.com/watch?v=ay4vWqjj5Bo

dzintars commented 4 years ago

meta: { websocket: true} approach would allow to do something like this meta: { websocket: true, host: "wss://public.api.domain.com"}. I mean, it could be possible to specify to which host this action should go. But it has it's own downsides by cluttering the codebase with host addresses there and there.