Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a HTTP server in react native

I want to be able to send music to sonos using its API. Unfortunately the only way I know is to send an URI to the device so it can download it.

I have visited already the package react-native-httpserver. This one has not been tested in Android. So I had a look over Android's nanoHTTPD and other similar packages in iOS as CocoaHTTPServer is.

It should not very difficult to create a wrapper over those packages to build something cross-platform but I wonder if there is another solution in Javascript or some work developing over react-native-tcp

like image 896
jsdario Avatar asked Sep 15 '16 15:09

jsdario


1 Answers

I'll answer my own question, time has passed by and some packages have been released. Even with limitations, but looks promising so far:

  • HTTP Static server: https://github.com/futurepress/react-native-static-server
  • Quite flexible (but Android only) https://www.npmjs.com/package/react-native-http-server
  • Limited but both platforms https://github.com/alwx/react-native-http-bridge
like image 156
jsdario Avatar answered Oct 18 '22 07:10

jsdario