[Xmpp4js-commit] SF.net SVN: xmpp4js: [724] xmpp4js-launcher/src/main/webapp/simpleclient. html
Status: Beta
Brought to you by:
h-iverson
From: <h-i...@us...> - 2008-07-05 21:39:41
|
Revision: 724 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=724&view=rev Author: h-iverson Date: 2008-07-05 14:39:49 -0700 (Sat, 05 Jul 2008) Log Message: ----------- added transport selector Modified Paths: -------------- xmpp4js-launcher/src/main/webapp/simpleclient.html Modified: xmpp4js-launcher/src/main/webapp/simpleclient.html =================================================================== --- xmpp4js-launcher/src/main/webapp/simpleclient.html 2008-07-05 21:31:15 UTC (rev 723) +++ xmpp4js-launcher/src/main/webapp/simpleclient.html 2008-07-05 21:39:49 UTC (rev 724) @@ -21,6 +21,15 @@ <dt>Password</dt> <dd><input type="password" name="password"/></dd> + <dt>Transport</dt> + <dd><select name="transport" onchange="this.form.endpoint.value = (this.value == 'script' ? 'https://bosh.soashable.com:7443/http-bind/' : '/http-bind/');"> + <option value="script" onclick="">Script (X-Domain)</option> + <option value="bosh">BOSH (Local Servlet)</option> + </select></dd> + + <dt>Transport Endpoint</dt> + <dd><input type="text" name="endpoint" value="https://bosh.soashable.com:7443/http-bind/"/></dd> + <dt></dt> <dd><button type="submit">Login</button></dd> </dl> @@ -70,12 +79,13 @@ * Connect and set handler that will attempt login */ login: function(form) { + + // store this for onConnectForLogin + this.loginForm = form; + // set up the connection this.init(); - // store this for onConnectForLogin - this.loginForm = form; - // set a listener to call onConnectForLogin once when connected this.con.on("connect", this.onConnectForLogin, this, {single: true} ); @@ -130,11 +140,17 @@ init: function() { var stanzaProvider = new Xmpp4Js.Packet.StanzaProvider(); stanzaProvider.registerDefaultProviders(); + + var transportClasses = {bosh: Xmpp4Js.Transport.BOSH, script: Xmpp4Js.Transport.Script}; + + var endpoint = this.loginForm.endpoint.value; this.con = new Xmpp4Js.Connection({ transport: { - clazz: Xmpp4Js.Transport.Script, - endpoint: "https://bosh.soashable.com:7443/http-bind/" // where your BOSH server is running. + useKeys: true, + + clazz: transportClasses[ this.loginForm.transport.value ], + endpoint: endpoint // where your BOSH server is running. // NOTE: same origin policy means you need some sort of proxt, or a servlet. }, stanzaProvider: stanzaProvider, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |