How to use react-native-zeroconf - 1 common examples

To help you get started, we’ve selected a few react-native-zeroconf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GPMDP / google-play-music-desktop-remote / src / screens / ZeroConfScreen.js View on Github external
componentDidMount () {
    this.CONNECTED_IP = this.props.settingsStore.IP_ADDRESS
    this.zeroconf = new Zeroconf()
    this.zeroconf.scan('GPMDP')
    // this.zeroconf.scan('GPMDP')
    this.zeroconf.on('start', () => console.log('start.'))
    this.zeroconf.on('found', () => console.log('found'))
    this.zeroconf.on('resolved', (service) => {
      if (service.host !== this.CONNECTED_IP) {
        console.log('found service, adding to list', service)
        this.setState({
          devices: this.state.devices.concat([service])
        })
        // this.props.settingsStore.updateIPAddress(service.host)
      }
    })
    this.zeroconf.on('remove', (serviceName) => {
      console.log('removed', serviceName)
      this.setState({

react-native-zeroconf

A Zeroconf discovery utility for react-native

MIT
Latest version published 4 months ago

Package Health Score

69 / 100
Full package analysis

Popular react-native-zeroconf functions