Hi,
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://echo.websocket.org) with Kong. I have tried
- Added custom nginx.conf with pointers mentioned here (https://github.com/Kong/kong/issues/218)
in thehttpdirective:
# 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;
- Added this to kong.yml
services:
- name: echoserver
url: http://localhost:9002
routes: myroute- name: echoserverroute
paths:- /
- name: echoserverroute
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.
Regards.