Pushing information to web clients

The IoT Gateway includes a mechanism to push information to connected web clients. Pages that accept information pushed to them, should include the Events.js JavaScript file in a JavaScript metadata reference. For example:

JavaScript: /Events.js

Each such page will include JavaScript that creates a TabID and registers itself with the server-side ClientEvents class, defined in Waher.IoTGateway. The ClientEvents class can then be used to check which tabs are registered with it, and for which resources. It can also be used to push data to the page. Methods available are:

Method

Description

GetOpenLocations()

Returns an array of locations (relative URLs) currently being viewed.

GetTabIDsForLocation()

Returns the Tab IDs of clients currently viewing a given page. The pages can be filtered based on query parameters.

GetTabIDsForLocations()

Returns the Tab IDs of clients currently viewing any of a given set of pages.

GetTabIDs()

Gets an array of connected clients. Each tab in a browser has a separate Tab ID.

PushEvent()

Pushes a type and corresponding data to a set of Tab IDs. The data can be JSON. The type should correspond to a JavaScript function taking one parameter. The Event.js JavaScript running in the clients with the corresponding Tab IDs will receive the event and call the corresponding function with the data provided.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.108.9