mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 22:47:03 +08:00
socket-io
Try it at https://expo.io/@community/socket-io-example
How to use
Running the app
cdinto theappdirectory and runyarnornpm install- Open
appwithexpor XDE, try it out.
Running the server (optional)
cdinto thebackenddirectory and runyarnornpm install, then runyarn start- Install ngrok and run
ngrok http 3000and copy the https url that looks something like thishttps://f7333e87.ngrok.io. This is required because WebSockets require https. - Open
app/main.jsand change theSocketEndpointat the top of the file to point to your endpoint.
The idea behind the example
React Native provides a socket-io compatible WebSocket implementation, some people get tripped up on the https requirement so this example helps to clarify how you can get it running.