Node.js Physical Web Advertiser
May 23, 2018 ยท View on GitHub
phyweb is a Node.js advertiser for Physical-Web. It supports currently advertising URLs over SSDP protocol.
Requirement
- Requires Node.js >= 0.10.x (tested with v0.10.25)
- No Platform requirements: Win, Linux and Mac are supported
Setup
-
clone module and install dependencies
git clone <URL to this repository> cd phyweb npm install
Usage
-
run following command in
phywebfoldernode phyweb URL [URL2] [URL2] ... -
Example: advertise the two URLs
http://www.fokus.fraunhofer.de/fameandhttp://physical-web.orgnode phyweb URL http://www.fokus.fraunhofer.de/fame http://physical-web.org
How it works?
phyweb waits for SSDP M-SEARCH requests with type urn:physical-web-org:device:Basic:1 from Physical-Web clients and replies with a SSDP packet for each URL. Below are the SSDP search and response packets for the example above:
-
Physical-Web Client e.g. Android or iOS client sends the following SSDP
M-SEARCHPacket:M-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: 2 ST: urn:physical-web-org:device:Basic:1 -
phyweb receives the
M-SEARCHrequest and responds with the following SSDP packets (one packet for each URL):HTTP/1.1 200 OK NT: urn:physical-web-org:device:Basic:1 USN: uuid:6bd5eabd-b7c8-4f7b-ae6c-a30ccdeb5988::urn:physical-web-org:device:Basic:1 LOCATION: http://www.fokus.fraunhofer.de/fame SERVER: Windows_NT/6.1.7601 UPnP/1.1 phyweb/0.0.1HTTP/1.1 200 OK NT: urn:physical-web-org:device:Basic:1 USN: uuid:6bd5eabd-b7c8-4f7b-ae6c-a30ccdeb5988::urn:physical-web-org:device:Basic:1 LOCATION: http://physical-web.org SERVER: Windows_NT/6.1.7601 UPnP/1.1 phyweb/0.0.1 -
Physical-Web client needs to read the
LOCATIONheader and pass the URL (value ofLOCATIONheader) to the corresponding component in the Physical-Web client for further processing and then to display the result to the user.
License
Copyright 2014 Fraunhofer FOKUS
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Contact
Fraunhofer FOKUS - Competence Center FAME // Future Applications and Media