1👍
✅
just convert that file to base64 and send that as json along with it’s type, then only you can retrieve it properly from database.
const reader = new FileReader();
reader.readAsDataURL(blob)
reader.onload = (e) => {
base64_data = e.target.result;
base64_value(base64_data)
}
chatSocket.send(JSON.stringify({
'command':'new_message',
'message': base64_data,
'from': username,
'msg_type':type
}));
Source:stackexchange.com