skip to Main Content

I know how to POST data from a React Native app to the server with axios, but I don’t know how I can POST data from the server to React Native. Is there a way to listen for requests from the server, or a way to handle requests to "routes" in the app (if they even exist)?

2

Answers


  1. Either you are looking for

    • Sockets (full duplex) a persistent communication channel between client and server
    • or there might be a miss understanding on your end on how client server architecture is supposed to work, where a client usually only sends requests (and the server replies with a response)
    • and then there is long polling (half duplex)

    You might want to read up on this topics.

    Login or Signup to reply.
  2. What do you mean by "POST data from the server to React Native"?
    React Native is client, and you can’t possibly fire a HTTP request to client. If you want to trigger something in React Native from the server, you can just use some real time bi-directional connection. Like HTTP/2 or socket.io, or just simple as long polling

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search