Sha256: dc0e1438884588b5952847ebfae37398c6e0aefd9c28cf02bfc1f4e4f5beaa6e

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

# NetService

NetService is a simple wrapper around NSNetService. It publishes and consumes services over Bonjour.

## Installation

Command Line:

```bash
gem install motion-net-service
```

Bundler:

```ruby
gem 'motion-net-service'
```

## Usage

Publishing a NetService (Bonjour) service:

```ruby
@service = NetService.new(name: "amazaballs", port: 4321, sear).tap do |ns|
  ns.on_did_publish do
    puts "I published a service"
  end
  ns.on_did_not_resolve do |error|
    puts "Oh crap, I got an error: #{error}"
  end
end

@service.publish
```

Consuming a service

```ruby
@n = NetServiceBrowser.search('_ssh._tcp') do |service, more_coming|
  p "name: #{service.name}
  p "service url: #{service.hostName}:#{service.port}"
  p "More coming?: #{more_coming}"
end
```

## License

MIT, check the LICENSE file.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-net-service-0.0.2 README.md