evennia.server.portal.wire_formats.evennia_v1

Evennia V1 wire format (v1.evennia.com).

This is Evennia’s legacy WebSocket wire format. All messages are UTF-8 JSON text frames in the form:

[“cmdname”, [args], {kwargs}]

Text output is HTML-converted from ANSI before sending. This format is used by Evennia’s built-in webclient and is the default when no WebSocket subprotocol is negotiated.

class evennia.server.portal.wire_formats.evennia_v1.EvenniaV1Format[source]

Bases: WireFormat

Evennia’s legacy wire format: JSON arrays over TEXT frames.

Wire format:

All frames are TEXT (UTF-8 JSON). Structure: [“cmdname”, [args], {kwargs}]

Text handling:

Outgoing text is converted from ANSI to HTML via parse_html().

OOB:

All commands are effectively OOB — the cmdname field can be any string, not just “text”.

name = 'v1.evennia.com'
supports_oob = True
decode_incoming(payload, is_binary, protocol_flags=None)[source]

Decode incoming JSON array message.

Parameters:
  • payload (bytes) – UTF-8 encoded JSON: [“cmdname”, [args], {kwargs}]

  • is_binary (bool) – Should be False for this format.

  • protocol_flags (dict, optional) – Not used by this format.

Returns:

dict or None – kwargs for data_in(), e.g. {“text”: [[“look”], {}]}

encode_text(*args, protocol_flags=None, **kwargs)[source]

Encode text output as HTML-converted JSON.

Converts ANSI color codes to HTML spans, applies screenreader and raw text options.

Returns:

tuple or None – (json_bytes, False) where False means TEXT frame.

encode_prompt(*args, protocol_flags=None, **kwargs)[source]

Encode a prompt as HTML-converted JSON with send_prompt flag.

Returns:

tuple or None – (json_bytes, False) for TEXT frame.

encode_default(cmdname, *args, protocol_flags=None, **kwargs)[source]

Encode any OOB command as a JSON array.

Skips the “options” command (legacy behavior).

Returns:

tuple or None

(json_bytes, False) for TEXT frame, or None

if cmdname is “options”.