This is a breaking change to the WebSockets layer to align it with recent specification documentation work. To support this, HAL SimValue changed readonly to a direction enum. This allows specifying bidirectional in addition to input and output. The SimValue change is specifically designed to avoid API and ABI breakage. This is completely transparent in C++; in Java a new callback class was added, and the old readonly functions have been marked deprecated. A new SimValue creation function for enums allows specifying double values for each enum value, not just strings. This allows mapping enum values to doubles in the WebSockets layer. A ":" in the SimDevice name now maps it to different WebSocket types (e.g. "Accel:Name" becomes type "Accel", device "Name"). The type is hidden in the GUI. Other WebSockets changes: * Implemented match_time and game_data * Added joystick rumble data * Added builtin accelerometer support * SimValue enums are mapped to string and double value on WS interface * Added WebSockets protocol specification * Added READMEs
981 B
HAL WebSockets Server
This is an extension that provides a server version of a WebSockets API for transmitting robot hardware interface state over a network. See the Robot Hardware Interface WebSockets API specification for more details on the protocol.
Configuration
The WebSockets server has a number of configuration options available through environment variables.
HALSIMWS_SYSROOT: The local directory to serve non-websocket HTTP content from (e.g. HTML files) starting from /. Defaults to the sim subdirectory of the current working directory.
HALSIMWS_USERROOT: The local directory to serve non-websocket HTTP content from (e.g. HTML files) starting from /user/. Defaults to the sim/user subdirectory of the current working directory.
HALSIMWS_PORT: The port number to listen at. Defaults to 3300.
HALSIMWS_URI: The URI path to use for WebSockets connections. Defaults to "/wpilibws".