ugly websocket port binding, but works for two modes