playwriter serve
Start the relay server on this machine (must be the same host where Chrome is running). Remote clients (Docker, other machines) connect viaPLAYWRITER_HOST.
Options
Host to bind to:
localhost- For Docker access via host.docker.internal (no token needed)0.0.0.0- For LAN/internet access (requires--token)
Authentication token, required when
--host is 0.0.0.0 (or use PLAYWRITER_TOKEN env var)Kill existing server if running on the same port
Server Details
The relay server:- Runs on port
19988(hardcoded) - Logs to
~/.playwriter/relay.log - CDP logs to
~/.playwriter/cdp.jsonl - Sets process title to
playwriter-serve
Returns
Prints server status to stdout:Exit Codes
0- Server stopped cleanly (Ctrl+C)1- Error:- Token required for public host
- Port already in use (without
--replace) - Uncaught exception
- Unhandled rejection
Examples
Security Notes
- When
--hostis0.0.0.0or::, a token is required - The token authenticates all connections via
Authorization: Bearer <token>header - For Docker on the same machine, use
--host localhost(no token needed) - Never expose the relay server publicly without authentication
Error Messages
Missing token for public host
Port already in use
Signal Handling
The server handles shutdown signals gracefully:SIGINT(Ctrl+C) - Closes server and exitsSIGTERM- Closes server and exits