Hi, thanks for a nice lib.
Is sending/receiving binary data not supported, or I just don't know how to use the lib?
When I try to send binary data (image) I get an error "Could not decode a text frame as UTF-8."
My test code is your demo code with this one change in line 14 in demo\server.php:
$socket->sendData($item, file_get_contents('tst.webp'));
and this change in demo\index.html:
websocket.onmessage = function (ev) {
var img = document.createElement('img');
img.src = 'data:image/webp;base64,' + btoa(ev.data);
document.body.appendChild(img);
};
Hi, thanks for a nice lib.
Is sending/receiving binary data not supported, or I just don't know how to use the lib?
When I try to send binary data (image) I get an error "Could not decode a text frame as UTF-8."
My test code is your demo code with this one change in line 14 in demo\server.php:
$socket->sendData($item, file_get_contents('tst.webp'));and this change in demo\index.html:
websocket.onmessage = function (ev) {
var img = document.createElement('img');
img.src = 'data:image/webp;base64,' + btoa(ev.data);
document.body.appendChild(img);
};