9

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

Community
  • 1
  • 1
jsdario
  • 6,477
  • 7
  • 41
  • 75

3 Answers3

14

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

jsdario
  • 6,477
  • 7
  • 41
  • 75
  • 2
    Thanks for this! It is so difficult to search for this and not get basic tutorials on react-native-cli. – Reed Spool Dec 21 '17 at 18:27
  • I am now searching for one of these two things and I'm having similar trouble: Serving a webm file over one of these http servers, or starting a Websocket server. Any thoughts? – Reed Spool Dec 22 '17 at 21:22
  • For serving files I guess I'd use HTTP Static server – jsdario Dec 24 '17 at 12:25
  • I am trying to create an app that cast local files but I am unable to do that, any idea how to access local files on server using above module – abdemirza Feb 17 '22 at 10:47
0

For those of you still looking for a good package to open a HTTP server in react native, react-native-http-bridge is unmaintained, but there is a maintained version:

Big G
  • 211
  • 1
  • 9
-3

Try to use react-native-fetch-blob https://github.com/wkh237/react-native-fetch-blob, I have used it to send pictures and It works very well. It supports both ios and Android

Emery
  • 37
  • 1
  • 2
  • 5