Skip to content

Instantly share code, notes, and snippets.

@superseb
Last active November 9, 2022 19:20
Show Gist options
  • Save superseb/89972344508e99b9336ad7eff78cb928 to your computer and use it in GitHub Desktop.
Save superseb/89972344508e99b9336ad7eff78cb928 to your computer and use it in GitHub Desktop.
Websocket test Rancher 2

Run WebSocket test for Rancher 2

Option 1: curl

Replace rancher.yourdomain.com with your Rancher URL and token-xxxxx:string with your API bearer token.

Using curl

This depends on the version of curl used (especially cross operating system)

curl -s -i -N \
                            --http1.1 \
                            -H "Connection: Upgrade" \
                            -H "Upgrade: websocket" \
                            -H "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
                            -H "Sec-WebSocket-Version: 13" \
                            -H "Authorization: Bearer token-xxxxx:string" \
                            -H "Host: rancher.yourdomain.com" \
                            -k https://rancher.yourdomain.com/v3/subscribe

Using curl via Docker

docker run --net=host appropriate/curl -s -i -N \
                            -H "Connection: Upgrade" \
                            -H "Upgrade: websocket" \
                            -H "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
                            -H "Sec-WebSocket-Version: 13" \
                            -H "Authorization: Bearer token-xxxxx:string" \
                            -H "Host: rancher.yourdomain.com" \
                            -k https://rancher.yourdomain.com/v3/subscribe

Option 2: rancher2ws

Replace rancher.yourdomain.com with your Rancher URL and token-xxxxx:string with your API bearer token.

docker run --net=host superseb/rancher2ws:latest rancher.yourdomain.com token-xxxxx:string
@Tejeev
Copy link

Tejeev commented Jun 16, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment