Simple Service Discovery Protocol (SSDP) Server
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
test
.gitignore
CHANGELOG.md
LICENSE
README.md
mix.exs
mix.lock

README.md

Nerves.SSDPServer

Simple Server for the Simple Services Discovery Protocol

SSDP allows devices on LAN to announce themselves and their services to other devices.

Installation

If available in Hex, the package can be installed as:

  1. Add nerves_ssdp_server to your list of dependencies in mix.exs:

    def deps do [{:nerves_ssdp_server, "~> 0.2.2"}] end

  2. Ensure nerves_ssdp_server is started before your application:

    def application do [applications: [:nerves_ssdp_server]] end

Usage

In SSDP, every service needs to define a USN (unique service name), and a ST (service type). That's the minimum required to publish a service. With that info, it's as simple as this:

alias Nerves.SSDPServer

SSDPServer.publish "my_unique_service_name", "my-service-type"

Publishing custom fields

Other parameters you might specify for the second parameter to publish are included as fields of the published service. For instance, you can do..

alias Nerves.SSDPServer

@ssdp_fields [
    location: "http://localhost:3000/myservice.json",
    server: "MyServerName",
    "cache-control": "max-age=1800"
]

SSDPServer.publish "my-service-name", "my-service-type", @ssdp_fields

You can call publish to publish multiple services, each with a unique USN, but you can only publish each USN once, as per the SSDP spec.

The nerves-project-org:service:cell:1 service type

  • LOCATION if present, specifies a URL to grab a cell description

References

Here is are some links with background information about SSDP.

http://www.w3.org/TR/discovery-api/#simple-service-discovery-protocol-ssdp http://www.upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.0-20080424.pdf