mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 17:13:21 +08:00
socket-io
How to use
Running the app
cdinto theappdirectory and runyarnornpm install- Open
appwithexpo start, 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.