Skip to content

gurl ws

Connect to a WebSocket endpoint, either interactively (stdin to the socket, messages to stdout) or to send one message and exit.

Synopsis

gurl ws <url> [flags]
gurl ws <url> --send '<message>'

The URL is required. Without --send, the connection is interactive.

Flags

FlagShortDefaultDescription
--header-HnoneCustom header (key:value format)
--send-snoneSend a message and exit (one-shot mode)
--interactive-ifalseInteractive mode (stdin/stdout); the default when --send is not given
--pretty-pfalsePretty-print JSON messages
--color-cfalseEnable syntax highlighting
--timestamp-tfalseShow timestamps in output
--timeout-T30Connection timeout in seconds
--reconnect-rfalseReconnect automatically on disconnect
--max-retries3Maximum reconnection attempts
--insecure-kfalseSkip TLS verification (testing only)
--cacertnoneCA certificate file
--certnoneClient certificate file
--keynoneClient key file
--server-namenoneServer name for SNI

Aliases

  • websocket

Examples

Interactive session

gurl ws wss://echo.example.com/socket --pretty --timestamp

Send one message and exit

gurl ws wss://api.example.com/ws --send '{"type":"ping"}'

Authenticated connection that reconnects

gurl ws wss://api.example.com/stream -H 'Authorization:Bearer dev-token' --reconnect --max-retries 5

Related commands