Ports API
WebSocket Endpoints — Some endpoints in this section use WebSocket for bidirectional communication. The SDK handles the connection protocol automatically.
Watch Ports
Section titled "Watch Ports"WSS
/v1/sprites/{name}/ports/watchWatch for port open/close events across all processes in the sprite namespace. On connect, sends a snapshot of all currently listening ports as a port_list message, then streams incremental port_opened/port_closed events.
Responses
Section titled “Responses”| Status | Description |
|---|---|
101 | Switching Protocols - WebSocket connection established |
400 | Bad Request - Invalid WebSocket upgrade or missing parameters |
404 | Not Found - Resource not found |
Server → Client Messages
Section titled “Server → Client Messages”PortListMessage
Section titled “PortListMessage”| Field | Type | Description |
|---|---|---|
type | string | (const: "port_list") |
ports | PortNotificationMessage[] |
PortNotificationMessage
Section titled “PortNotificationMessage”| Field | Type | Description |
|---|---|---|
type | PortNotificationType | Notification type |
port | number | Port number |
address | string | Proxy URL for accessing the port |
pid | number | Process ID that opened/closed the port |
{ "address": "https://my-sprite.sprites.dev:3000", "pid": 1847, "port": 3000, "type": "port_opened"} Request