Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update demo page to use BOSH too

  • Loading branch information...
commit 515c82a99a58ce62facc9378e80f24a79853150d 1 parent 3b45af8
@legastero legastero authored
Showing with 15 additions and 2 deletions.
  1. +15 −2 demo.html
View
17 demo.html
@@ -79,7 +79,7 @@ <h1 id="logTitle">Events &amp; Data</h1>
<form id="loginInfo">
<label>JID: <input id="jid" type="text" name="jid" value="stanzaio@lance.im"/></label>
<label>Password: <input id="password" type="password" name="password" /></label>
- <label>WebSocket URL: <input id="wsURL" type="text" name="wsURL" value="" /></label>
+ <label>WebSocket/BOSH URL: <input id="url" type="text" name="url" value="" /></label>
<input id="connect" type="submit" value="Connect" />
</form>
</div>
@@ -123,10 +123,23 @@ <h1 id="logTitle">Events &amp; Data</h1>
var jid = document.getElementById('jid').value;
+ var url = document.getElementById('url').value;
+ var wsURL, boshURL, transport;
+
+ if (url.indexOf('http') === 0) {
+ boshURL = url;
+ transport = 'bosh';
+ } else if (url.indexOf('ws') === 0) {
+ wsURL = url;
+ transport = 'websocket';
+ }
+
client = XMPP.createClient({
jid: jid,
password: document.getElementById('password').value,
- wsURL: document.getElementById('wsURL').value
+ wsURL: wsURL,
+ boshURL: boshURL,
+ transport: transport
});
client.on('*', log);
Please sign in to comment.
Something went wrong with that request. Please try again.