I used these on server-side:
_ws.binaryType = 'arraybyte';
...
_ws.onMessage.listen((MessageEvent data) {
var response = JSON.decode(new String.fromCharCodes(new BZip2Decoder().decodeBytes(data.data)));
_sender_list[response['ws_id']].add(response);
if (response['status'] != 1) {
_sender_list[response['ws_id']].close();
}
}
Working well without compile to JS. With compile, we get the errors indicated.
The solution is use directly Blob.
//_ws.binaryType = 'arraybyte';
...
_ws.onMessage.listen((MessageEvent data) {
FileReader reader = new FileReader();
reader.onLoadEnd.listen((ProgressEvent event) {
var response = JSON.decode(new String.fromCharCodes(new BZip2Decoder().decodeBytes(reader.result)));
_sender_list[response['ws_id']].add(response);
if (response['status'] != 1) {
_sender_list[response['ws_id']].close();
}
});
reader.readAsArrayBuffer(data.data);
});
Now, the compilation works well.