Search code examples
javascriptpythonwebsocketautobahn

connecting to autobahn's WrappingWebSocketServerFactory with native javascript WebSocket


i am using the WrappingWebSocketServerFactory to wrap around an existing protocol. i am attempting to use native javascript websockets to connect, but get this error from the server as a result:

406 this server only speaks ['binary', 'base64'] WebSocket subprotocols

do i have to use autobahn's js library to proceed or will native websockets work?


Solution

  • i was initializing the websocket like so:

    ws = new WebSocket("ws://localhost:8080");
    

    i changed it to:

    ws = new WebSocket("ws://localhost:8080", ['binary']);