Files
examples/with-socket-io
Evan Bacon 55ef5cd8d4 Merge pull request #44 from expo/@evanbacon/use-remote-assets
Use remote assets only in the app.json
2020-01-20 12:21:24 -08:00
..
2020-01-16 18:56:24 -08:00
2019-10-02 10:43:08 -07:00

socket-io

How to use

Running the app

  • cd into the app directory and run yarn or npm install
  • Open app with expo start, try it out.

Running the server (optional)

  • cd into the backend directory and run yarn or npm install, then run yarn start
  • Install ngrok and run ngrok http 3000 and copy the https url that looks something like this https://f7333e87.ngrok.io. This is required because WebSockets require https.
  • Open app/main.js and change the SocketEndpoint at 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.