Mercurial > prosody-modules
comparison mod_websocket/websocket.html @ 129:5fc00a3e47b5
mod_websocket: Initial commit
author | Ali Sabil <ali.sabil@gmail.com> |
---|---|
date | Mon, 08 Feb 2010 12:29:30 +0100 |
parents | |
children | 14e10bce7463 |
comparison
equal
deleted
inserted
replaced
128:bdd1641c159d | 129:5fc00a3e47b5 |
---|---|
1 | |
2 | |
3 <!DOCTYPE html> | |
4 <html> | |
5 <head> | |
6 <title>XMPP Websocket</title> | |
7 <script type="text/javascript"> | |
8 if ("WebSocket" in window) { | |
9 var ws = new WebSocket("ws://localhost:5281/xmpp-websocket"); | |
10 ws.onopen = function() { | |
11 ws.send("<stream:stream to='localhost' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>"); | |
12 }; | |
13 ws.onmessage = function (evt) { | |
14 var message = evt.data; | |
15 alert ("Received frame: " + message); | |
16 }; | |
17 ws.onclose = function() { | |
18 alert ("Disconnected"); | |
19 }; | |
20 } else { | |
21 alert ("Your browser doesn't implement WebSocket !"); | |
22 } | |
23 </script> | |
24 </head> | |
25 <body> | |
26 </body> | |
27 </html> |