webos-service Module Introduction

The webos-service module for Node.js provides an interface to the system bus, wrapped in familiar Node.js idioms.

Code Example

This example registers a service (luna://com.example.helloworld/hello) on the webOS TV system bus, which responds to a request with a "Hello, World!" message.

// helloworld.js
// simple service, based on webos-service API
var Service = require('webos-service');

var service = new Service('com.example.helloworld');
service.register('hello', function (message) {
  message.respond({
    greeting: 'Hello, World!',
  });
});

Loading the webos-service library

This loads the webos-service module. The only thing exported from the webos-service module is the Service constructor.

var Service = require('webos-service');
No Headings