VILLASframework
Modular co-simulation framework
WebSocket

The websocket node type send and receives simulation data via binary WebSocket messages.

The message format is the same as used by the Sockets node-type.

Prerequisites

This node-type requires libwebsockets (>= 2.3.0).

Implementation

The source code of the node-type is available here: https://git.rwth-aachen.de/acs/public/villas/node/blob/master/lib/nodes/websocket.cpp

Configuration

By default the villas node daemon listens on http.port (integer) = 80 for HTTP and WebSocket requests. This behaviour can be disabled by setting http.enabled (boolean) = true to false.

destinations (array of URIs)

During startup connect to those WebSocket servers as a client.

Each URI must use the following scheme:

protocol://host:port/nodename

It starts with a protocol which must be one of ws (unencrypted) or wss (SSL). The host name or IP address is separated by ://. The optional port number is separated by a colon :. The node name is separated by a slash /.

Example

nodes = {
ws = {
type = "websocket"
destinations = [
"ws://someserver:8080/somenode"
]
}
}
http = {
port = 8080
htdocs = "/villas/contrib/websocket/"
ssl_cert = "/etc/ssl/certs/mycert.pem"
ssl_private_key= "/etc/ssl/private/mykey.pem"
}