Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

README++

  • Loading branch information...
commit f1bc5f8cd1a991165da12d14e3acfa5fa0d8fae9 1 parent 48c1976
Nathan Rajlich authored
Showing with 27 additions and 24 deletions.
  1. +27 −24 README.md
51 README.md
View
@@ -7,33 +7,36 @@ A module for NodeJS written in JavaScript to interface with UPnP compliant devic
Usage
-----
-This module is still ___alpha___ quality, and it's API is a work-in-progress and subject
-to change!
+This module is still ___alpha___ quality, and it's API is a work-in-progress and
+subject to change!
#### Discovery
-Discovering UPnP compliant devices on the network is usually the first step in anything
-UPnP-related:
-
- var upnp = require("upnp");
-
- var controlPoint = new upnp.ControlPoint();
- controlPoint.on("DeviceAvailable", function(device) {
- console.log(device.nt);
- //-> "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
- console.log(device.location);
- //-> "http://192.168.0.1/root.sxml"
- });
-
- controlPoint.on("DeviceFound", function(device) {
- console.log(device.st);
- //-> "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
- console.log(device.location);
- //-> "http://192.168.0.1/root.sxml"
- }
-
- controlPoint.search('urn:schemas-upnp-org:device:InternetGatewayDevice:1');
-
+Discovering UPnP compliant devices on the network is usually the first step in
+anything UPnP-related:
+
+``` javascript
+var upnp = require("upnp");
+
+// First, create a client instance
+var controlPoint = new upnp.ControlPoint();
+
+controlPoint.on("DeviceAvailable", function(device) {
+ console.log(device.nt);
+ //-> "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
+ console.log(device.location);
+ //-> "http://192.168.0.1/root.sxml"
+});
+
+controlPoint.on("DeviceFound", function(device) {
+ console.log(device.st);
+ //-> "urn:schemas-upnp-org:device:InternetGatewayDevice:1"
+ console.log(device.location);
+ //-> "http://192.168.0.1/root.sxml"
+}
+
+controlPoint.search('urn:schemas-upnp-org:device:InternetGatewayDevice:1');
+```
[UPnP]: http://upnp.org/
[NodeJS]: http://nodejs.org
Please sign in to comment.
Something went wrong with that request. Please try again.