Hermes
Simulation Orchestration Platform for Aerospace
Loading...
Searching...
No Matches
hermes.server.protocol Namespace Reference

Classes

class  ServerMessageType
class  EventType
class  CommandAction
class  ServerMessage
class  Command

Functions

ServerMessage make_schema (dict[str, Any] payload)
ServerMessage make_event (EventType|str event)
ServerMessage make_error (str message, int|None code=None)
ServerMessage make_ack (str action, dict[str, Any]|None details=None)

Detailed Description

WebSocket protocol messages for client-server communication.

This module defines the JSON message protocol used between Hermes
and connected clients (e.g., Daedalus visualization).

Message Types:
    Server → Client:
        - schema: Full signal schema on connect
        - event: State changes (paused, running, reset)
        - error: Error responses
        - ack: Command acknowledgments

    Client → Server:
        - cmd: Control commands with action and params

Function Documentation

◆ make_ack()

ServerMessage hermes.server.protocol.make_ack ( str action,
dict[str, Any] | None details = None )
Create command acknowledgment message.

Args:
    action: Command action being acknowledged
    details: Optional additional details

Returns:
    Ack message ready for transmission

◆ make_error()

ServerMessage hermes.server.protocol.make_error ( str message,
int | None code = None )
Create error response message.

Args:
    message: Error description
    code: Optional error code

Returns:
    Error message ready for transmission

◆ make_event()

ServerMessage hermes.server.protocol.make_event ( EventType | str event)
Create state change event message.

Args:
    event: Event type (running, paused, reset, stopped)

Returns:
    Event message ready for transmission

◆ make_schema()

ServerMessage hermes.server.protocol.make_schema ( dict[str, Any] payload)
Create schema message with signal definitions and optional wiring.

Args:
    payload: Schema payload containing 'modules' and optionally 'wiring'

Returns:
    Schema message ready for transmission