namibia
70bc99896b9aaaa4e6eb3f875f7443896f85d758
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>APE jQuery Test - Color Changer</title>
<script type="text/javascript" language="javascript" src="/js/vendor/jquery-1.9.1.min.js"></script>
<script type="text/javascript" language="javascript" src="/js/vendor/ape.js"></script>
<script type="text/javascript" language="javascript" src="/js/vendor/ape-config.js"></script>
</head>
<body>
<input id="chat" type="text"></input>
<button id="myButton" type="button">speaketh</button>
<button id="myButton2" type="button">who am i</button>
<div id="wrapper"></div>
<div id="debug">
<h2>Debug</h2>
</div>
</body>
</html>
<script type="text/javaScript">
$(document).ready(function() {
var apeChat = false;
$('#myButton').click(function () {
if (apeChat)
apeChat.send($('#chat').val());
});
$('#myButton2').click(function () {
if (apeChat)
apeChat.request.send('whoami', {});
});
// create our new shiney APE client
var client = new APE.Client;
//Load APE Core
client.load();
// set to false to disable debugging
var debug = true;
// load the APE client
client.addEvent('load', function() {
//3) Call core start function to connect to APE Server, and prompt the user for a nickname
client.core.start({"name": prompt('Your name?'), "ident": 123456789});
});
// listen for ready event to know when we are connected
client.addEvent('ready', function() {
debug && console.log('Your client is now connected');
//1) join 'testChannel'
client.core.join('synchv1');
//2) Intercept multiPipeCreate event
client.addEvent('multiPipeCreate', function(pipe, options) {
//3) Send the message on the pipe
apeChat = pipe;
pipe.send('Hello world!');
debug && console.log('Sending Hello world');
});
//4) Intercept receipt of the new message.
client.onRaw('data', function(raw, pipe) {
alert(JSON.stringify(raw.data));
});
//5) Push messages from the server.
client.onRaw('postmsg', function(raw, pipe) {
alert(JSON.stringify(raw));
//alert(raw.data.message);
debug && console.log('Receiving : ' + unescape(raw.data.message));
});
});
});
</script>
|
Revision |
Author |
Commited |
Message |
df0489 ...
|
Mark |
Fri 14 Oct, 2016 10:01:00 +0000 |
|