Socket

The socket extension manages a socket for devices to connect to and relay data through. The socket listens for incoming data and tries to detect any events that should be rebroadcast to MudPi. The socket extension is really useful to get data into MudPi throgh sockets.

Socket Settings

You can have multiple sockets started but only one per port. Here are some available configuration options.

OptionTypeRequiredDescription
key[String]YesUnique slug id for the socket
host[String]NoHost address to connect on. Default: 127.0.0.1.
port[Integer]NoPort to use for connection. Default: 7007.

Config Examples

Here is a config of a complete socket.

"socket": [{
    "key": "socket_1",
    "host": "127.0.0.1",
    "port": 7007
}]

Broadcasting Data

The socket is setup to listen for events in the same format as the event system. Once an event is received it will take the event data and broadcast it on the MudPi event bus. For example sending a StateUpdated event could be a way to trigger new data via a socket.