Javascript API

Introduction

When adding site_connect.js to your website you enable a lightweight publish/subscribe transport mechanism. The page contains a extremely lightweight message broker which allows one to route messages from publishers to multiple subscribers.

A Quick Overview

Messages are published to topics. All subscribers to a topic will get the message. A topic is a string, much like a file-path. For example "truck/001/temperature". A subscriber can directly subscribe to a topic, or use wildcards '+' and '#'. '+' matches exactly one word between the slashes, and '#' can be used at the end of a pattern to match all sub-topics.

Examples::

Publish/Subscribe in Channel.me

After loading //channel.me/site_connect.js it is possible to subscribe and publish topics on your local page.

Host Page

All topics on the host page begin with the '~/' character. Messages published under this topic are not transferred to the site-connect frame and remain local.

Site-Connect Frame

The site connect scripts loads a separate frame which serves as a connection to the channel.me servers. When a customer agent starts a co-browse or chat session this frame is used to display the interface. Components can be loaded on demand during the lifetime of the host-page. During its lifetime messages can be published. Subscribers can subscribe to these messages by subscribing to the following set of topics.

Site-Connect Topics

Co-browsing Topics

Site-Connect Frame Handling Topics

Chat Button Topics