S
S
Sergey Sulakov2020-02-21 13:16:42
Node.js
Sergey Sulakov, 2020-02-21 13:16:42

How to competently design backend real-time applications?

Good afternoon. On the server we use Node.JS + Express + ws .
Details: there is an application of educational games. The teacher works with the student. The teacher "gives" tasks to the student, the student sees them and performs them. Everything that the student enters into the fields or selects selects, the student sees the teacher in his place. That is, in fact, they work on the same page, and the data "goes" through the websocket. When connecting, all data on the lesson is collected and applied on the page, and then we wait for web-socket messages about changes on the page.
Additionally, there is a chat. Also, when connecting, we get a list of all dialogs and messages and wait for new messages via web-socket.
How best to do: two different connections? But how to separate them (namespaces or something like that)? Or one connection for all? But outside of the lesson, only chat is needed.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
@
@neacter, 2020-02-21
_

In fact, you have a chat and a window where a teacher and a student exchange a task should be implemented by different modules, respectively, and different connections ... I see no reason to call a chat connection when working with tasks

P
Philipp, 2020-02-22
@zoonman

It is architecturally correct to have 1 data transport connection. This saves resources.
Next, you need message routing.
For example: selects are processed by the page module, while chat messages are processed by the chat module.
All this is implemented quite trivially through the event bus.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question