Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better example on how to use this #26

Open
Nathan-ma opened this issue Jul 19, 2019 · 5 comments
Open

A better example on how to use this #26

Nathan-ma opened this issue Jul 19, 2019 · 5 comments

Comments

@Nathan-ma
Copy link

Hello, fairly new on the react-native scenario.

I need a few informations on how to use this lib properly, excuse me for my lack of experience on this framework.

Ok, I made a componente to use this lib, I need my device to get SSDP information from another device. So I believe I suppose to use this as a client.

I also understand the better usage would be on componentDidMount() so it can find the device I want when it loads.

My supper newbie questions are:

What do I have to import in order to make this work?
On the client example you can find on this github, what I can declare globaly like a variable and what I should put inside of componentDidMount to trigger the search?


the way I understood, the functions below are all based on client.search to search for all devices once every 5 seconds for 10 seconds

client.search('urn:schemas-upnp-org:service:ContentDirectory:1')

// Or maybe if you want to scour for everything after 5 seconds
setTimeout(function() {
  client.search('ssdp:all')
}, 5000)

// And after 10 seconds, you want to stop
setTimeout(function () {
  client.stop()
}, 10000)

and those are declarations I should make globally outside of classes and functions.

var ssdp = require('../index').Client
  , client = new ssdp({
//    unicastHost: '192.168.11.63'
  })

client.on('notify', function () {
  //console.log('Got a notification.')
})

client.on('response', function inResponse(headers, code, rinfo) {
  console.log('Got a response to an m-search:\n%d\n%s\n%s', code, JSON.stringify(headers, null, '  '), JSON.stringify(rinfo, null, '  '))
})
@Nathan-ma
Copy link
Author

I'm also facing this little issue:

Could not find method compile() for arguments [project ':react-native-udp']

on the build.gradle

@jasenkabalac
Copy link

Hi, I am also new at this, were you able to find all the devices in the end ?

@SethuSenthil
Copy link

Same, were you able to find any solutions? The docs seem to be a little confusing

@DeepakM02
Copy link

DeepakM02 commented Sep 29, 2021

@jsdario, @luisfpinto, @franrios, @pablopi

Can you guys please help us?

@sebasariz
Copy link

Hello, can help me, im need call an action from service. Please, can show me some example to make it.

tanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants