I'm working with other company to sending and receiving data in real time.
They give me a websocket URL like this: ws://domain.com/socket.io/?EIO=4&transport=websocket
and I need to connect to it for transfer data.
The problem is they said that data is encoded with base64 string, and when I received data, I couldn't completely decode it. When I decode data by atob()
function it show readable string but it had some special characters which I couldn't understand.
For example, here is one of the response messages in websocket:
h6d1c2VyS2V50Rqdom5v0wAAAYSBGgjtp3ZlcnNpb26mMS4xMy4wqXNlc3Npb25JZLAxNjY4NjEzMDI0NDM0NDM0o3NpZ6Cmc3luY0lkAKRib2R5gad1c2VyS2V50Rqd
When I decode base64 string, the result is:
\x87§userKeyÑ\x1A\x9D¢noÓ\x00\x00\x01\x84\x81\x1A\bí§version¦1.13.0©sessionId°1668613024434434£sig ¦syncId\x00¤body\x81§userKeyÑ\x1A\x9D
I simply decode it by atob(encodedData)
, and get back result like this. I don't know what problem is. How should I fix this?