-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspoot.html
33 lines (30 loc) · 957 Bytes
/
spoot.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
<script type="text/javascript"
src="http://localhost:9090/faye.js">
</script>
<script type="text/javascript">
var client = new Faye.Client('http://localhost:9090/faye', {
timeout: 120
});
function write_out() {
var a = Array.prototype.slice.call(arguments);
for (var i=0;i < a.length; i++ ) {
document.getElementById('out_text').value += a[i];
};
};
function go(){
var channel = document.getElementById('in_channel').value;
var text = document.getElementById('in_text').value;
client.subscribe('/'+channel, function(message) {
var c = channel;
write_out(channel,message.text);
});
client.publish('/'+channel, {text:text});
};
</script>
channel
<input id='in_channel' type='text' name='channel'></input>
text
<input id='in_text' type='text' name='text'></input>
<input type='submit' name='submit' onclick="go();"></input>
channel and text mash
<textarea id='out_text'></textarea>