Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (60 sloc) 2.98 KB
<!DOCTYPE html>
<html>
<head>
<title>Sample: Socket</title>
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
</head>
<body>
<div class="container">
<div class="columns">
<div class="column col-12">
<h1>Socket</h1>
<h2>Listen to socket events in the browser.</h2>
<p>Initialize the SDK with <a target="_blank" href="https://developer.webex.com/docs/api/getting-started">Your Personal Access Token</a>.</p>
<form class="form-group" id="credentials">
<fieldset>
<label class="form-label" for="access-token">Your Personal Access Token</label>
<input
class="column col-8"
id="access-token"
name="accessToken"
placeholder="Your Personal Access Token"
type="text" />
<button class="btn" id="connect" title="connect" type="submit">Initialize</button>
</fieldset>
<p class="label label-warning" id="connection-status">not initialized</p>
</form>
<p>Open this browser's <em>inspection tools</em> to view the <em>console</em>.</p>
<p>
After this app initializes it calls the <em>listen()</em> function on the SDK's <em>message,
membership, and rooms</em> objects, and registers handlers for the events. These handlers simply
log the content of the events in the console window. To see this activity, open
<a href="https://teams.webex.com/teams/" target="_blank">a Webex Teams client</a> and
create rooms, memberships or messages.
These activities will generate an event which will fire and display in the console.
</p>
<p>
See the Webex <a href="https://developer.webex.com/docs/api/guides/webhooks/filtering-webhooks">Webhook Documentation</a>
for more information on the payloads of the membership, message and room events. In general
the SDK events closely match the payload of the webhooks, except in cases where the information
in a traditional webhook envelope doesn't make sense, for example there is no <em>name, targetUrl</em>, or
<em>secret</em> field in the SDK event envelopes.
</p>
<p>
The SDK adds one event which is not yet supported in the webhooks. A <em>memberships:seen</em> event
is generated when a Webex client sends a "read receipt". The <em>membership:seen</em> event will include a
<em>lastSeenId</em> field with the id of the last message read by the user.
</p>
<p>
View the <a href="./app.js">
source for this app</a>
</p>
</div>
</div>
</div>
<!-- /bundle.js is the bundled Webex JavaScript SDK -->
<script src="/bundle.js"></script>
<!-- app.js is your application code -->
<script src="app.js"></script>
</body>
</html>
You can’t perform that action at this time.