DataV-WS integrates the static file service and WebSocket. The static file service is used to load local model addresses. WebSocket can be used in the blueprint editor to connect multiple projects in the same network range without additional development. This topic describes how to use DataV-WS.
DataV-WS document directories
Notice Do not delete the
assets
directory.
Start and stop DataV-WS
- Windows:
- Download the DataV-WS installation package.
- Decompress the package and double-click the datav_ws_win.exe file.
- View the returned message. If the following information appears, DataV-WS is started:
Server listen on IP address:8181 (for example, 127.0.0.1:8181)
Notice Do not close the command prompt after the start. - Develop and demonstrate WebSocket and the static file service after you start DataV-WS. For more information, see Configure DataV-WS.
- Linux or macOS:
- Run the following command to download the DataV-WS installation package:
wget http://sh-conf.oss-cn-shanghai.aliyuncs.com/doc_files/datav_ws.zip
- Decompress the package, start the terminal, and enter the service directory, for example, datav-ws.
- Run the following commands to start DataV-WS (port 8001 is used by default):
chmod 777 ./ sh exec.sh start
You can run the sh exec.sh stop command to stop DataV-WS.
You can run the sh exec.sh restart command to restart DataV-WS.
- Develop and demonstrate WebSocket and static file service after you start DataV-WS. For more information, see Configure DataV-WS.
- Run the following command to download the DataV-WS installation package:
Configure DataV-WS
You can configure WebSocket and the static file service.
- Configure WebSocket.
- Development:
- Start DataV-WS on your local computer. For more information, see Start and stop DataV-WS.
- Log on to the DataV console.
- Create an empty DataV project.
- In the upper-left corner of the canvas editor, click the Blueprint Editor icon. The blueprint editor appears.
- In the blueprint editor, drag and drop the WebSocket node to the canvas.
- Click the WebSocket node in the blueprint editor and set Socket Endpoint to
ws://127.0.0.1:8181
.
- Demonstration:
- Start DataV-WS on a demonstration server that is in the same network range as the development server. For more information, see Start and stop DataV-WS.
- Add a WebSocket node. Set Socket Endpoint of the WebSocket node to
ws://IP address of the demonstration server:8181
. The projects that use the two WebSocket nodes can communicate with each other.
- Development:
- Configure the static file service.
- Start DataV-WS on your local computer. For more information, see Start and stop DataV-WS.
- Add static files (such as images) to the assets directory.
- Log on to the DataV console.
- Create an empty DataV project.
- In the canvas editor, add an image widget. For more information, see Add a widget.
- Set Background Image to
http://IP address:8181/p2544435894.webp
so that the project can obtain the image from DataV-WS.