Node.js device
Node.js device library
Node.js device library allows only one device instance per single Node process. Device UUID is stored in ./id.json file, under device root directory. Multiple devices can be started on single physical machine, however, due to necessity of storing device UUID, each device need to be started in separate working directory.

Optionally, you can use GateHub to facilitate running multiple devices on one physical machine. If GateHub is running, devices started on same physical machine will fetch server location data from GateHub instead of using built-in discovery, so they won't block discoveryPort for each other. As consequence, devices will be able to join server simultaneously without delay. Additionally, GateHub autostart feature can be utilised to run all desired devices automatically.

Node.js device library can be used in conjunction with Controller library.
Configuration
Device configuration is stored in ./dist/config.js and - if necessary - can be overriden directly in file, in code (modifying fields of GateDevice.config object) or using environment variables (with parameter names in upper snake case - i.e. discoveryKeyword should be DISCOVERY_KEYWORD). By default, Device is configured as follows:
discoveryKeyword: GateServer
discoveryPort: 10001
hubDiscoveryPort: 10000
discoveryInterval: 5000
queryTimeout: 5000
handshakeTimeout: 5000
useFixedUrl: false
fixedUrl: localhost:10002
Meaning of parameters:
discoveryKeyword - identifier of server the device intends to join
discoveryPort - port on which device will listen to discovery messages
hubDiscoveryPort - port on which device will fetch server location data from GateHub
discoveryInterval - expected interval of sending discovery messages (milliseconds)
queryTimeout - max time (milliseconds) device will wait for query response (i.e. ServerStorage.get() response)
handshakeTimeout - max time (milliseconds) device will wait for handshake with server to complete
useFixedUrl - if set to "true", device will connect to fixedUrl instead of using discovery
fixedUrl - fixed server location. Has no effect if useFixedUrl is false