Heartbeat check against websocket URL

Hi,

Is there a way I can check my webservice's websocket's "heartbeat"? I just want heartbeat to be able to connect to a websocket URL and verify a JSON response.

I'm currently trying this but its failing

- type: http
  name: 'Websocket Check'
  schedule: '@every 5s'
  urls: ["http://myserver:80/myservice/wsendpoint"]
  check.request:
    headers:
      'Pragma': 'no-cache'
      'Origin': 'http://myserver'
      'Accept-Encoding': 'gzip, deflate'
      'Accept-Language': 'en-US,en;q=0.9'
      'Sec-WebSocket-Key': 'YzcC7Fy1g/mlss3qO2Kz1Q=='
      'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'
      'Upgrade': 'websocket'
      'Sec-WebSocket-Extension': 'permessage-deflate; client_max_window_bits'
      'Cache-Control': 'no-cache' 
      'Connection': 'Upgrade'
      Sec-WebSocket-Version': '13'

Note: I got this parameters from my chrome - by right clicking on the websocket URL and copying as CURL

Note2: If I use the CURL command in my bash (and as long as I replace the 'ws://' part with 'http://', it works). But the same settings though dont work with heartbeat

Any thoughts?

Thanks,
Franz

Nevermind, after posting my question here, i saw the problem :smiley:

My header Sec-WebSocket-Version wasnt properly quoted :smiley:

Thanks anyway! :smiley:

2 Likes

Sorry for the late reply, but glad you found an answer!

We should, however, make this easier to configure, ideally we'd just have a websocket mode. Thanks for this awesome post :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.