Forum

configuring VirtualHost for a websocket

Josh Peterson
3 May 2017, 21:11
I am new to Hiawatha, and have had some trouble configuring the web server to use a websocket. My test websocket server is using 127.0.0.1:9091/ws, and I would like to access that through 127.0.0.1:9093. Here is how I have configured the virtual host entry in hiawatha.conf:

Binding {
BindingID = AIOHTTP_WS
Port = 9093
Interface = 127.0.0.1
}
#aiohttp websocket
VirtualHost {
Hostname = localhost
RequiredBinding = AIOHTTP_WS
WebsiteRoot = /home/peterjo8/dev/test/evaluations/webserver
WebSocket = ws://127.0.0.1:9091 / 30
}


The rest of my configuration file is stock. When I try connecting a Python client to 127.0.0.1:9093, the access log shows a 404 error:

127.0.0.1|Wed 03 May 2017 14:54:55 -0400|101|0||GET / HTTP/1.1|Sec-Websocket-Version: 13|Upgrade: Websocket|Sec-Websocket-Key: katlFzROzj76Sb4T5BS9EQ==|Accept: */*|Accept-Encoding: gzip, deflate|Host: localhost:9093|User-Agent: Python/3.5 aiohttp/1.3.5|Content-Length: 0|Connection: upgrade


I do not see any activity on the websocket server.

I would appreciate suggestions to help me figure out what I am doing wrong.
Hugo Leisink
6 May 2017, 22:45
The access log doesn't show a 404 http code, but a 101. Looks like some request has been forwarded to the websocket...
This topic has been closed.