Updated websocket handling to support cowboy 0.8.6

Changes are based on the websocket example in cowboy