peer-dial-prompt
v0.2.0
Published
Nodejs implementation of the Discovery and Launch Protocol DIAL
Maintainers
Readme
peer-dial-prompt
A fork of peer-dial modified for testing DIAL app launch on Amazon Fire TV and Vega devices. This module implements the Discovery and Launch Protocol DIAL as described in the Protocol Specification Document.
Changes from original peer-dial
Hybrid device discovery (SSDP + network scan)
The test client uses a two-phase approach to find DIAL devices on the network:
- SSDP multicast discovery (5s) - finds devices advertising via standard DIAL protocol
- Subnet port scan - scans the local /24 subnet on common DIAL ports (60000, 8008, 8060) to find devices that have DIAL running but don't respond to SSDP
This hybrid approach was needed because Vega OS devices run dial-service (DIAL HTTP endpoints on port 60000 for device description, port 8009 for apps) but the SSDP multicast component does not respond to M-SEARCH requests on current builds.
Interactive device selection and app launch
After scanning, the client:
- Displays a table of all discovered DIAL devices (name, manufacturer, model, IP)
- Lets you select which device to target
- Prompts for the
dial_idvalue (from the app'smanifest.toml) - Launches the app via DIAL and reports success/failure
Updated dependencies
All dependencies updated to latest versions. Deprecated packages replaced:
node-uuidreplaced withuuidopnreplaced withopen- Added
prompt-syncfor interactive input
Dependencies
- Node.js
- All other dependencies installed via
npm install
Setup
npm installRun Examples
DIAL Client (scan and launch)
node test/dial-client.jsThe client will automatically scan your network and present a list of DIAL devices to choose from. Example output:
=== DIAL Device Scanner ===
[1/2] Running SSDP discovery (5s)...
[2/2] Scanning subnet 192.168.4.0/24 on ports 60000, 8008, 8060...
Found 2 DIAL device(s):
# | Name | Manufacturer | Model | IP
---|--------------------------|--------------|----------------|----------------
1 | Behyad Vega BH | Amazon | AFTCA002 | 192.168.4.195:60000
2 | DIAL Demo Server | Fraunhofer | DIAL Demo | 192.168.4.182:3000
Select device # (or 'q' to quit):DIAL Server (for local testing)
node test/dial-server.jsStarts a DIAL server on port 3000 that advertises via SSDP and supports app launch.
Verifying DIAL on a device manually
# Check DIAL is running (look for port 60000)
adb shell netstat -tlnp
# Test device description endpoint
curl -v http://<DEVICE_IP>:60000/dd.xmlThe response should include an Application-URL header pointing to the apps endpoint (typically http://<DEVICE_IP>:8009/apps/).
Known Issues
- SSDP discovery not working on Vega OS - The
dial-serviceon Vega devices does not respond to SSDP multicast M-SEARCH requests, even though the DIAL HTTP endpoints are functional. The subnet port scan works around this by connecting directly to known DIAL ports. Mobile companion apps that rely solely on SSDP will not discover these devices.
API
The peer-dial module contains implementation for DIAL Client and Server.
Server
var dial = require("peer-dial-prompt");
var http = require('http');
var express = require('express');
var app = express();
var server = http.createServer(app);
var dialServer = new dial.Server({
expressApp: app,
port: 3000,
prefix: "/dial",
corsAllowOrigins: "*",
manufacturer: "My Company",
modelName: "My Device",
delegate: {
getApp: function(appName) { /* return app object */ },
launchApp: function(appName, launchData, callback) { /* launch logic */ },
stopApp: function(appName, pid, callback) { /* stop logic */ }
}
});
server.listen(3000, function() {
dialServer.start();
});CORS can be controlled via corsAllowOrigins (default: disabled). Set to true to allow all origins, or pass a string, regex, or function. See the cors package docs.
Client
var dial = require("peer-dial-prompt");
var dialClient = new dial.Client();
// Get device description
dialClient.getDialDevice("http://<IP>:60000/dd.xml", function(dialDevice, err) {
// Get app info
dialDevice.getAppInfo("myApp", function(appInfo, err) {
// Launch app
dialDevice.launchApp("myApp", "launchData", "text/plain", function(res, err) {
console.log("Launched!");
});
});
});License
Free for non commercial use released under the GNU Lesser General Public License v3.0. See LICENSE file.
Contact us for commercial use [email protected]
Copyright (c) 2015 Fraunhofer FOKUS
