Simple websocket server on Kong

I am a newbie to this realm of web services and gateways. I have gone through documentation and tried using kong on my local machine (Cent OS).

I have been trying to figure out how to configure a simple websocket server (hosted at localhost) like the echoserver(wss:// with Kong. I have tried

  1. Added custom nginx.conf with pointers mentioned here (
    in the http directive:
# Websocket
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;

in the server directive:

proxy_http_version 1.1;

# Proxy Websocket Upgrade request
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
  1. Added this to kong.yml

But still i am not able to connect to it. I tried:
wscat -c http://localhost:9002

But it waits like forever to connect and when i press Ctrl+C it gives following error:
“error: WebSocket was closed before the connection was established”

Help / guidance is needed. Kindly help on how to use Kong for a websocket service.