react-native-use-websocket icon indicating copy to clipboard operation
react-native-use-websocket copied to clipboard

Question: react-native-use-websocket onMessage response different from 'normal' ws response

Open wswebcreation opened this issue 3 years ago • 1 comments

First of all thanks for this great lib!

I'm trying to use react-native-use-websocket in a RN 0.66.3. I know that you can there use the Websocket but for some reason it was failing all the time and this lib didn't.

The WS that I need to connect to responds with a buffer, it's basically streaming images so they can be used to mimic a video. The challenge I have now is that when I set up a WS and log the onMessage I get back a JSON response, something like this

onMessage =  {"data": [], "isTrusted": false}

But when I use a simple Node script when I use the ws lib and log the result I see the buffer being printed. Is there some reason why this isn't working in the same way? Do I need to configure something else?

Thanks in advance

wswebcreation avatar Dec 15 '21 11:12 wswebcreation

Hmm, for some reason I can't seem to change the binaryType to blob which might fix my issue. The docs mention how to change that, but that doesn't work.

Might this be the problem?

image

wswebcreation avatar Dec 15 '21 13:12 wswebcreation