... | @@ -10,8 +10,21 @@ The Nomad 3D Viewer web application uses a *node.js* server and clients are web |
... | @@ -10,8 +10,21 @@ The Nomad 3D Viewer web application uses a *node.js* server and clients are web |
|
|
|
|
|
![Communication](resources/Nomad3DViewer-com.png)
|
|
![Communication](resources/Nomad3DViewer-com.png)
|
|
|
|
|
|
The figure shows the main objects of the communication between the server and client.
|
|
The figure shows the main objects of the communication between the server and client. The clients requests:
|
|
|
|
- 3D model with different LODs (level of details)
|
|
|
|
- Positions of the axis
|
|
|
|
- Get the list of simulated servers
|
|
|
|
- Pause/restart the animation
|
|
|
|
The 3D model data are binary data and can be very big for finest LODs and common websocket messages cannot hold such data.
|
|
|
|
That is why using the streams was a solution and allowed to transfer big data with the chunks. However only using the stream for all requests/responses forced to implement a special "protocol".
|
|
|
|
here is how the communication works.
|
|
|
|
When a client opens a connection on the server, a stream is opened between the server and the client, meaning that there is as many streams as the number of clients. For each type of request, there is a handler that is why the data collected must be dispatched to the correct handler e.g. there is a handler for the positions request, another one for pause/restart requests, etc.
|
|
|
|
To implement the dispatch, the messages are organised as follows:
|
|
|
|
- start: the name the request hashed into a fixed length word with _START_.
|
|
|
|
- content, binary or ascii depending on the type of request.
|
|
|
|
- end: the name the request hashed into a fixed length word with _END_.
|
|
|
|
|
|
|
|
A message is cut into chunks that are sent through the stream. When the message is read, the handler name read allows to dispatch it to the correct handler. The *StreamDispatcher* object is responsible for collecting and forwarding the message to the correct handler. There is one *StreamDispatcher* on the client side and as many as clients on the server side.
|
|
|
|
|
|
## Environment map
|
|
## Environment map
|
|
|
|
|
... | | ... | |