Skip to content

Turn MSSP WEBSOCKET into measured WebSocket endpoints - #217

Merged
HarryCordewener merged 2 commits into
mainfrom
claude/project-thread-qzf138
Nov 15, 2026
Merged

HarryCordewener merged 2 commits into
mainfrom
claude/project-thread-qzf138

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What

A game's MSSP WEBSOCKET variable was stored as a field and nothing else, so no catalogue game had a websocket endpoint. Two games declare one today: MUME (wss://mume.org/ws-play/) and The Last Outpost (wss://last-outpost.com/ws/telnet/).

  • Migration 0045: game_endpoint.path and game_endpoint.subprotocol (websocket kinds only, an RFC 6455 token). It is allowed only on websocket kinds, and must be a printable-ASCII path of at most 256 characters. There is a new kind wss. Identity stays (host, port).
  • Probe (MUI.Crawl/WebSocket):
    • WebSocketAddresses reads the variable as a comma-separated list. It refuses user information, fragments, non-ASCII text, other schemes and over-long paths. At most 4 addresses are read.
    • WebSocketProbe does one handshake, at the addresses the scope guard ruled on. It uses no proxy, checks the certificate, and closes straight after the upgrade.
    • The probe offers the four mudstandards.org names (telnet, gmcp, terminal, json) and records the one the server chooses. Evennia 6.1 picks terminal, gmcp or json, never telnet, and talks its own JSON when nothing is chosen, so the choice is what tells a client what to speak.
    • On an HTTP refusal of that offer, the probe asks again with none, and an upgrade there is recorded with no subprotocol. websockify answers 400 and MUME's Apache 502 to names they don't know.
  • Writer (WebSocketEndpointWriter, run by CrawlCycle after an answered probe):
    • Each address goes through the opt-out gate first, then the scope guard. Only then is it handshaken.
    • An address that upgrades becomes an endpoint with its path.
    • A failed handshake writes nothing.
    • An address that another game holds, or that is one of this game's telnet addresses, is left as it is.
  • API: endpoints[].path and endpoints[].subProtocol, null except on a websocket. A wss endpoint is reported as kind: "websocket" with tlsMeasured: true. The game page and plain text show the URL.

Testing

  • All six suites pass locally against Postgres 16.
  • Tests cover parsing, the handshake against a loopback bridge that refuses unknown subprotocols, the cycle writing wss + path, and that nothing is written on a failed handshake, a scope refusal or an opt-out. A database test checks the path constraints.
  • Live check through this sandbox's proxy: both bridges answer 101 to the handshake the probe makes. The probe's own pinned-socket path couldn't run here, because the sandbox has no DNS or direct egress.

Not done: an endpoint the game stops declaring stays active, as with every other kind (nothing sets stale yet).


Generated by Claude Code

A game's MSSP WEBSOCKET variable names the addresses a web client can
use. It was stored as a field and nothing else, so no game in the
catalogue had a websocket endpoint and a client listing games could
not offer one.

Each declared ws:// or wss:// URL is now handshaken after an answered
probe, through the opt-out gate and the scope guard (dialled at the
addresses it ruled on), offering no subprotocol, since websockify and
MUME's Apache both refuse one they do not know. An address that
upgrades becomes an endpoint (kind websocket, or the new wss) with its
path; one that does not writes nothing. An address another game holds,
or one of this game's telnet addresses, is left as it is.

The API's endpoint gains `path` (null except on a websocket); a wss
endpoint is kind "websocket" with tlsMeasured true. The game page and
plain text show the URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7SNv2XNNK6ro5YvSJP
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A socket that upgraded says nothing about what a client must speak on
it. Evennia 6.1 chooses terminal., gmcp. or json.mudstandards.org and
never telnet., and with no choice made it talks its own JSON, so a
telnet client that dialled an Evennia endpoint listed as "websocket"
would send bytes Evennia reads as malformed JSON.

The handshake now offers the four mudstandards.org names and keeps the
one the server chose. A server that answers the offer with an HTTP
refusal (websockify's 400, MUME's Apache 502) is asked again with no
offer, so the stricter bridges still upgrade and are recorded with no
subprotocol, as before.

game_endpoint gains subprotocol (websocket kinds only, an RFC 6455
token), and the API's endpoint gains subProtocol. The game page shows
the name beside the URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7SNv2XNNK6ro5YvSJP
@HarryCordewener
HarryCordewener marked this pull request as ready for review November 15, 2026 21:42
@HarryCordewener
HarryCordewener merged commit 8776eed into main Nov 15, 2026
2 checks passed
HarryCordewener pushed a commit that referenced this pull request Nov 16, 2026
#217 (merged on main) checks each declared WEBSOCKET URL with a
handshake through the opt-out and the scope guard, retries with no
subprotocol after an HTTP refusal, and records the result as an endpoint.
This branch's check measured the same URLs again, under a second
migration numbered 0045. This commit removes it: WebSocketCheck,
websocket_checked_at, capability.websocket.measured, AsksNothing and the
disagreement sentence.

What stays from this branch is TelnetNegotiationCore 4.13.5 and the
probe's telnet-over-WebSocket transport (ProbeLine, mui-probe wss://).
The transport test now names System.Net.WebSockets.WebSocket in full,
because main's MUI.Crawl.Tests.WebSocket namespace shadows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4
HarryCordewener pushed a commit that referenced this pull request Nov 16, 2026
The matrix gains a WEBSOCKET row. Declared comes from MSSP's WEBSOCKET
variable like any other capability. Measured comes from the WebSocket
endpoints the crawl recorded (#217), which no telnet handshake can show:

- standard: a live endpoint chose a mudstandards.org subprotocol. The
  cell links https://mudstandards.org/websocket/ and names the choice.
- none: a live endpoint upgraded but chose none (websockify, MUME's
  Apache, The Last Outpost).
- unknown: no live endpoint, which is also what a declared URL that
  never upgraded looks like.

None is never shown as absent and measured is never Absent: a failed
upgrade writes no endpoint, so nothing here says a game has no
WebSocket (rule 5). The API's capability gains webSocket and
subProtocol on that row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4
HarryCordewener added a commit that referenced this pull request Nov 16, 2026
…port WEBSOCKET support (#216)

* Move to TelnetNegotiationCore 4.13.2, and probe telnet over WebSocket

TelnetNegotiationCore 4.6.1 -> 4.13.2 and MarkupString.Ansi 2.31.0 -> 2.31.3.

The probe now starts its sessions with StartAsync on an ITelnetTransport
rather than BuildAndStartAsync on a TcpClient or SslStream. ProbeLine owns
the socket under a session (TCP, TLS or WebSocket) and is the only place
the three differ; the two copies of the connect-and-handshake code in
SessionAsync and the plaintext MSSP trial are gone.

OnStarting sets PromptSink's interpreter and the MCP plugin before the read
loop reads a byte, instead of straight after the build and arguing that no
prompt could arrive in between.

Live() reads TelnetConnection.Closed instead of polling the TcpClient, so it
works on every transport and sees a TLS peer's close the same way.

ProbeTarget.ForWebSocket(uri) dials a ws:// or wss:// URL offering
telnet.mudstandards.org and telnet. The upgrade goes through a one-dial
SocketsHttpHandler whose ConnectCallback dials the scope guard's vetted
addresses, never a fresh lookup. DialFailure unwraps WebSocketException and
HttpRequestException to the socket or TLS error under them. mui-probe
takes a ws:// or wss:// URL in place of the host. The crawl loop does not
dial WebSockets yet; CatalogueBinder and CrawlCycle are made correct for a
WebSocket result so wiring it later cannot mislabel one as telnet or
clear a target's TLS flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4

* Measure the WebSocket URL a game declares, beside the declaration

WEBSOCKET joins the capability pairs. A game's MSSP WEBSOCKET value already
became capability.websocket.declared; the crawl loop now dials the first
ws:// or wss:// URL it names and writes capability.websocket.measured
under the handshake source (rule 1).

The check runs after a game's own probe answers, at most once a day per
address (crawl_target.websocket_checked_at, migration 0045,
DiscoveryOptions.WebSocketCheckInterval). It goes through the opt-out
and the scope guard on the URL's host with no operator-seed exemption,
dials the vetted addresses, and types nothing (ProbeTarget.AsksNothing):
the measurement already asked what there was to ask.

True needs a telnet session that said something. False only for an
answer from the far end: refused, a TLS handshake it would not finish,
or an upgrade it turned down. A timeout, no route or failed lookup writes
nothing about the game, and nothing from the check reaches presence,
availability or endpoints.

The game page's disagreement sentence for WEBSOCKET says the URL was
dialled and did not answer with a telnet session, not that a handshake
never offered it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4

* Move to TelnetNegotiationCore 4.13.5, and read bridged WebSocket servers

The probe's WebSocket dial now offers gmcp.mudstandards.org and
terminal.mudstandards.org after the telnet names, and reads a server
that picks one through TNC's client bridge. Evennia has no telnet layer
on its WebSocket and picks gmcp; before this, a check of its declared
URL could only fail. The bridge drops the probe's telnet commands, so a
server with no telnet layer never sees IAC bytes in front of its login.

The dial still connects its own ClientWebSocket so it can dial the
scope guard's addresses. 4.13.5's redial with no subprotocol after an
HTTP error (websockify, Apache) needs ConnectAsync to accept an
invoker, which is TelnetNegotiationCore#201.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4

* Drop the WebSocket URL check that #217 already does

#217 (merged on main) checks each declared WEBSOCKET URL with a
handshake through the opt-out and the scope guard, retries with no
subprotocol after an HTTP refusal, and records the result as an endpoint.
This branch's check measured the same URLs again, under a second
migration numbered 0045. This commit removes it: WebSocketCheck,
websocket_checked_at, capability.websocket.measured, AsksNothing and the
disagreement sentence.

What stays from this branch is TelnetNegotiationCore 4.13.5 and the
probe's telnet-over-WebSocket transport (ProbeLine, mui-probe wss://).
The transport test now names System.Net.WebSockets.WebSocket in full,
because main's MUI.Crawl.Tests.WebSocket namespace shadows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4

* Report WEBSOCKET in the capability matrix: unknown, none or standard

The matrix gains a WEBSOCKET row. Declared comes from MSSP's WEBSOCKET
variable like any other capability. Measured comes from the WebSocket
endpoints the crawl recorded (#217), which no telnet handshake can show:

- standard: a live endpoint chose a mudstandards.org subprotocol. The
  cell links https://mudstandards.org/websocket/ and names the choice.
- none: a live endpoint upgraded but chose none (websockify, MUME's
  Apache, The Last Outpost).
- unknown: no live endpoint, which is also what a declared URL that
  never upgraded looks like.

None is never shown as absent and measured is never Absent: a failed
upgrade writes no endpoint, so nothing here says a game has no
WebSocket (rule 5). The API's capability gains webSocket and
subProtocol on that row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rqqt7VYxc7wynmb9N719J4

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants