/** * Portal WebSocket layer — mounts on the existing HTTP server, routes the * `upgrade` event by URL path, and bridges browser frames + input events * between the canvas Portal node and a Playwright session. * * Server → Client /portal/:id/screencast JPEG frames + url notifications * Client → Server /portal/:id/input mouse / keyboard / wheel * * Frame protocol (text JSON): * { "type": "frame", "data": "", "viewport": { "w": ..., "h": ... } } * { "type": "url", "url": "https://..." } * { "type": "error", "error": "..." } * * Input protocol (text JSON, client → server): * { "type": "mousemove", "x": 0..1, "y": 0..1 } (normalized) * { "type": "mousedown" | "mouseup", "x", "y", "button": "left" | "middle" | "right" } * { "type": "wheel", "x", "y", "deltaX", "deltaY" } * { "type": "keydown" | "keyup", "key": "a" | "Enter" | ... } * { "type": "type", "text": "..." } (raw text input) * { "type": "navigate", "url": "..." } */ import type { Server as HttpServer } from "node:http"; /** * Mount the portal WebSocket handlers on the given HTTP server. Call once * after `app.listen()`. The function is idempotent — repeated calls overwrite * the previous listener. */ export declare function attachPortalWebSockets(server: HttpServer): void;