react-native-ssdp
react-native-ssdp copied to clipboard
A better example on how to use this
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, ' '))
})
I'm also facing this little issue:
Could not find method compile() for arguments [project ':react-native-udp']
on the build.gradle
Hi, I am also new at this, were you able to find all the devices in the end ?
Same, were you able to find any solutions? The docs seem to be a little confusing
@jsdario, @luisfpinto, @franrios, @pablopi
Can you guys please help us?
Hello, can help me, im need call an action from service. Please, can show me some example to make it.
tanks