Comparison

mod_tcpproxy/web/demo.html @ 148:f2f9b965d1ad

mod_tcpproxy: Add web/ folder containing demo JS client
author Matthew Wild <mwild1@gmail.com>
date Tue, 13 Apr 2010 04:52:15 +0100
child 1343:7dbde05b48a9
comparison
equal deleted inserted replaced
147:4db80a46b064 148:f2f9b965d1ad
1 <html>
2 <head>
3 <script type="text/javascript" src="xmpp.io.js"></script>
4 <script type="text/javascript" src="strophe.js"></script>
5 <script type="text/javascript" src="src/jquery-1.4.2.min.js"></script>
6 <script type="text/javascript">
7 function handle_connection_status(status, err)
8 {
9 console.log("XMPP status: "+Strophe.Status.CONNECTED);
10 if(status == Strophe.Status.CONNECTED)
11 {
12 var conn = new XMPPIO(xmppconn, "tcp.localhost");
13 conn.addListener("connect", function () {
14 var req = "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n";
15 console.log("Sending request: "+req);
16 conn.write(req);
17 });
18 conn.addListener("data", function (data)
19 {
20 $("<div/>").text(data).appendTo("body");
21 });
22 console.log("Connecting to example.com:80...");
23 conn.connect("example.com", 80);
24 }
25 }
26
27 var xmppconn = new Strophe.Connection("/http-bind");
28 xmppconn.connect("anon.localhost", null, handle_connection_status, 50);
29
30 </script>
31 </head>
32 <body>
33 </body>
34 </html>