-
Notifications
You must be signed in to change notification settings - Fork 63
NodeJS server for the Web of Things Framework
This will expand into a full description of the Web of Things Framework and the NodeJS implementation
The Internet of Things suffers from fragmentation with numerous non-interoperable platforms and data silos. The Web of Things seeks to address this by connecting IoT platforms via the Web, using an abstraction layer above the transport protocols, as no one protocol is a good fit to all situations. The starting point is the notion of "things" as virtual representations of physical or abstract entities, where the virtual representations are hosted on web servers.
Each "thing" has a URI for a declarative description in terms of the thing's events, properties, actions and metadata. The description is formally based on W3C's resource description framework (RDF). This description is used when registering a "thing" along with its implementation (server B below). It is also used when creating a proxy on one server (server A) for a thing on another server (server B).
The framework avoids the need for web developers to deal directly with the transport protocols. Instead, developers script the objects created by the framework in the script's execution environment. Things can have properties which are other things. The framework automatically deals with this by creating proxies for these other things. The process allows for cyclic dependencies between things, e.g where A depends on B which in turn depends upon A. When A starts and B has yet to start, any messages sent from A to B are automatically held until B has started.
The NodeJS implementation of the Web of Things Framework provides a method for registering a new thing along with its name, description and implementation. The name is used to construct the URI by which the thing's description will be published. The implementation is an object which must have start and stop method, both of which are passed the object corresponding to the "thing". The start method provides an opportunity to initialise the thing, and to register observers for events that occur for the "thing".
Additional methods are provided for registering and unregistering a proxy. When registering a proxy, you provide the URI for its description and a function to be called when the proxy has been instantiated as a "thing" in the scripts execution space. This function is passed the object for the "thing" and can be used to register observers for events that occur for the thing.