robtaussig / react-use-websocket

React Hook for WebSocket communication
MIT License
1.63k stars 135 forks source link

Build to release environment, socket connection failed #89

Closed vmto closed 3 years ago

vmto commented 3 years ago

Build to release environment, socket connection failed

"react-use-websocket": "^2.6.1",
"react-native": "0.61.5",
robtaussig commented 3 years ago

Could you expand on what your issue is? Is there a stack trace that you can share?

vmto commented 3 years ago

Could you expand on what your issue is? Is there a stack trace that you can share?

After packing, On Android, switch between new Webscoket and useWebsocket, useWebsocket does not send . https://snack.expo.io/vQuFB8k_d

I have a screenshot . 01 02 03 04

robtaussig commented 3 years ago

Thanks @vmto for setting up the demo. I'm not familiar with Android development, nor snack.expo.io, so I might be missing some nuance, but what do you make of this?

Screen Shot 2021-06-09 at 9 55 06 AM

I changed the ws url to a public service that echoes back any messages sent to it.

Demo here: https://snack.expo.io/e93ZCJMiw

It was difficult for me to use devtools to inspect websocket traffic when using Android mode, because I don't have access to the original ws endpoint and because the messages and console.log's are handled remotely and communicated via http polling. That said, the above test suggests that it can work on Android, no?

vmto commented 3 years ago

Thanks @vmto for setting up the demo. I'm not familiar with Android development, nor snack.expo.io, so I might be missing some nuance, but what do you make of this?

Screen Shot 2021-06-09 at 9 55 06 AM

I changed the ws url to a public service that echoes back any messages sent to it.

Demo here: https://snack.expo.io/e93ZCJMiw

It was difficult for me to use devtools to inspect websocket traffic when using Android mode, because I don't have access to the original ws endpoint and because the messages and console.log's are handled remotely and communicated via http polling. That said, the above test suggests that it can work on Android, no?

Usewebsocket is an excellent socket connection library, especially in the friendly aspect of hooks. I like its API design very much. At present, I can't reproduce the bugs of Android compiled app. I can only capture the screenshots through fiddler.exe agent. I had to use native websocket in my project to meet my needs. I will study use websocket further. Thank you for your time.

robtaussig commented 3 years ago

@vmto I appreciate the kind words, and I'm sorry that we couldn't get to the bottom of this. I will keep this issue open for another week to see if anyone else reports the same issue.