modified ws example from https://github.com/ninenines/cowboy/tree/master/examples/websocket