How could I inflate data ,I use Pako.js,php gzdeflate
server and client use websocket pass data
javascript
websocket.onmessage = function (e) {
// var c = new Uint8Array(e.data.arrayBuffer())
var blob = e.data;
var reader = new FileReader();
reader.readAsBinaryString(blob);
reader.onload = function (evt) {
console.log(evt.target.result)
var data = pako.inflate(evt.target.result, { to: `string` })
console.log(JSON.parse(data))
};
php
$data = gzdeflate('asdfsadf11');
foreach($server->connections as $conn) {
$server->push($conn, $data,WEBSOCKET_OPCODE_BINARY);
}
not work