-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupnpserver_base.js
42 lines (34 loc) · 1.04 KB
/
upnpserver_base.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* global module */
"use strict";
const Server = require('node-ssdp').Server;
class upnpServer {
constructor(parameters) {
this.parameters = parameters;
//console.log(parameters);
this._server = new Server(parameters);
}
createServer() {
// Define callbacks
//console.log("Defining callbacks");
this._server.on('advertise-alive', function (headers) {
// Expire old devices from your cache.
// Register advertising device somewhere (as designated in http headers heads)
//console.log("Advertising")
//console.log(headers);
});
this._server.on('advertise-bye', function (headers) {
// Remove specified device from cache.
//console.log("Saying Bye")
//console.log(headers);
});
}
startServer(something) {
//console.log("Superclass start server: " + something);
this._server.start();
}
stopServer(something) {
//console.log("Superclass stop server " + something);
this._server.stop();
}
}
module.exports = upnpServer;