I’m creating a react native application using Expo that connects to a WebSocket server to display data from the messages. The code I have works for Web and iOS but for some reason will not work on Android. It looks like the WebSocket connects, but no messages are received.
A test websocket server is wss://webserver14.sms-timing.com:10015
and the start message is START 19476@teamsportreading
Here is an expo snack of with the code https://snack.expo.dev/@waddas/cranky-soda.
Any help is greatly appreciated!
2
Answers
Change the WebSocket URL from ws://webserver14.sms-timing.com:10015 to wss://webserver14.sms-timing.com:10015. This change will ensure that a secure WebSocket connection is established on both iOS and Android devices
Make sure that in the app.json file that you have the necessary permissions set.
"android": {
"permissions": [
"INTERNET"
]
}