N
N
naruto33332020-11-05 01:38:06
Software design
naruto3333, 2020-11-05 01:38:06

How to make microservices from websockets?

I have service A and B on the backend on different machines. The user connects through the browser to service B via a websocket, but during this session he also needs to communicate with service A, also via a websocket. I will not be able to open 2 websockets in the browser. How then to make service B go to A? Or do you need to make a mediator in the form of a message bus between them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0nkery, 2020-11-05
@naruto3333

Yes, it is desirable that you have a single entry point to the system, because it will take a lot of time to set up a websocket gateway normally, and it will be useful if you suddenly decide to change the architecture - add a C service, for example. Your client should not worry about these subtleties (generally).
Further, it is not necessary that the client directly access services A and B - the web socket gateway can communicate with internal services itself and implement complex interaction scenarios in the backend.
Don't forget that the internal network is much faster and more stable than the external network that the client will walk on - the more communications there are inside the internal network, the better.
Well, think again - do you really need separate services? Maybe it's better to get by with a monolith?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question