• I've manager to reproduce one of these issues using a current build on linux.

    vue native sockets in chrome browser -> Backend Espruino WS server.

    If protocol is specified, then all is well:

    const ws = new WebSocket('ws://', 'protocolOne');

    However, if this is defaulted, ws.js on the espruino sends as a header:

    Sec-WebSocket-Protocol: undefined

    this test seems to be failing:

    if (this.protocol)
        socketHeader.push("Sec-WebSocket-Protoco­l: "+this.protocol);

    in the constructor we have:
    this.protocol = options.protocol;

    So it seems this is setting this.protocol=undefined.

    What is the cleanest way to fix?

    if ( typeof(this.protocol) != 'undefined' )


Avatar for Wilberforce @Wilberforce started