React Native how can Ш create http websocket for handle post request - react-native

I have a react native project that was created on the expo and will work on android.
I want to create a HTTP server on any port on localhost and I will take the request body from there and use it anywhere on my project.
How can I do that?
Apk will work on a phone that will be connected to a different network. I can't connect to the internet

Related

connect to Wireguard with react native

I want to build an application using react native the UI is not that hard for me I can handle it my main problem is I can not make the application interact with the VPN configs file that I have from Wireguard
can you guys please guide me to make my react native app interacts with the phone VPN API so I can connect the configs file to it
I also want to build VPN with React NATIVE, but i Can't find proper library.
I Found this but i think old VERSION
https://www.npmjs.com/package/react-native-vpn-testing-only

disable http/2 requests in old react-native 0.38.1

We have upgraded our Nginx server and some requests from a mobile app build with react native 0.38.1 http requests stoped working. If we disable http/2 on nginx the requests works again. The problem is noticed only on android phones.
Is there a way to disable react native http2 calls?
We use RNFetchBlob.fetch(.... ) to execute http calls
the error we receive is
Error: Expected ':status' header not present

Impossible to use proxy

I'm trying to use proxy with my react-native app (build with CRNA and Expo).
So in my package.json file I put : "proxy": "192.168.1.27:8080" and then make simple get request with fetch with the/users` path and react call me network error (he don't see the proxy param, just /users when I'm debugging).
The fetch request work well if I put the full url.
In react (for website) I do the same thing and that's work to.
Thank's for your help.
In Reactjs proxies are mainly used to avoid cors issues. Since React Native connects to iOS & Android natively, there is no browser issue so you don't need a proxy.
The approach I use is to call http:127.0.0.1:nnnn/api/route (not localhost) in the React Native app when testing the backend, and the deployed url in production. So you can deploy your server separately and reach it directly in the app.

Create http websocket server on React Native app

I would like exchange small data and text on React Native app in offline context. I know React is only for the View, but is it possible to create small http websocket serveur on React-Native app using socket.io ?
socket io is a nodejs module and can't use in RN. you should use react-native-tcp
visit TCP server mode with react native
and
https://github.com/PeelTechnologies/react-native-tcp
Yes, you can use socket io client with react native app by simply installing this plugin socket.io-client

How to receive native messages from chrome extension to Mac app?

I have a Chrome extension which gets the location URL and I want it to send that URL to a Mac app.
I was able to run this demo, but I don't know how I can receive the message in a Mac app. Where would get I the message?
There are two approaches you can use.
Native Messaging API. This does have the limitation that Chrome must launch the process and communicate to it through stdio,
conforming to native message API protocols .
Your native app can expose a web server on a local port. The
extension can then try to connect to this port and talk to your app.
I would suggest the first solution as its a pretty secure soultion.