How to convert websocket 2.0 data to readable data


  • Hi @admin

    I tried updating websocket with websocket 2.0, authentication is successful and able to receive data. While conversion from byte to readable string, data is not able to convert properly.

    Used below code from earlier websocket version. Can you please help

    let strData = atob(evt.data);

                    // Convert binary string to character-number array
                    var charData = strData.split('').map(function (x) { return x.charCodeAt(0); });
    
                    // Turn number array into byte-array
                    var binData = new Uint8Array(charData);
    
                    // Pako magic
                    var result = _atos(pako.inflate(binData));
1 out of 1