-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconnect.html
59 lines (46 loc) · 1.72 KB
/
connect.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<head>
<title>Respoke - Connect Example</title>
<!-- Respoke client library -->
<script src="https://cdn.respoke.io/respoke.min.js"></script>
<!-- jQuery, for this example -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<!-- Some simple styles to make things perty -->
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h3 id="status">Not Connected</h3>
<div id="login">
<input id="endpoint" placeholder="Username" type="text" />
<button id="doLogin">Connect</button>
</div>
<script type="text/javascript">
// App ID value from the dev portal. You can play
// around with the supplied ID but should replace it
// with your own.
var appid = "b4931d40-ff2b-4c46-8487-bf955a75501d";
// The ID that other users will identify you by (your username)
var endpointId;
// Create the client object using the App ID
var client = respoke.createClient({
appId: appid,
developmentMode: true
});
// "connect" event fired after successful connection to Respoke
client.listen('connect', function() {
$("#status").html("Connected to Respoke as \"" + endpointId + "\"");
});
// Connect to Respoke when the user clicks "connect"
$("#doLogin").click(function() {
// Update the status message
$("#status").html("Connecting...");
// Grab our username
endpointId = $("#endpoint").val();
// Connect to Respoke
client.connect({
endpointId: endpointId
});
});
</script>
</body>
</html>