Author: ngn
Date: Sun May 30 21:16:46 2010
New Revision: 949579

URL: http://svn.apache.org/viewvc?rev=949579&view=rev
Log:
Adding example (VYSPER-204). By Bogdan Pistol

Added:
    mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/
    
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/
    
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.html
    
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.js

Added: 
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.html
URL: 
http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.html?rev=949579&view=auto
==============================================================================
--- 
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.html
 (added)
+++ 
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.html
 Sun May 30 21:16:46 2010
@@ -0,0 +1,66 @@
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+       
+         http://www.apache.org/licenses/LICENSE-2.0
+       
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+
+<html>
+<head>
+<title>BOSH client</title>
+</head>
+<body>
+
+<div id="connect-form" style="margin: auto; width: 300px;">
+<table>
+       <tr>
+               <td>Server</td>
+               <td><input type="text" id="server" value="vysper.org" /></td>
+       </tr>
+       <tr>
+               <td>Port</td>
+               <td><input type="text" id="port" value="8080" /></td>
+       </tr>
+       <tr>
+               <td>JID</td>
+               <td><input type="text" id="jid" value="[email protected]" /></td>
+       </tr>
+       <tr>
+               <td style="padding-right: 10px;">Password</td>
+               <td><input type="password" id="password" value="password1" 
/></td>
+       </tr>
+       <tr>
+               <td />
+               <td><input type="button" id="connect" value="Connect"
+                       style="float: right; margin-top: 5px;" /></td>
+       </tr>
+</table>
+</div>
+
+
+<div style="position: absolute; left: 0; width: 100%; bottom: 0px;">
+<div id="logger"
+       style="border: 1px solid; height: 300px; overflow: scroll; margin: 
10px; font-family: arial; display: none;">
+</div>
+</div>
+
+<script src="../resources/jquery/jquery-1.4.2.min.js"></script>
+<script src="../resources/flXHR/flensed.js"></script>
+<script src="../resources/flXHR/flXHR.js"></script>
+<script src="../resources/strophe/strophe.min.js"></script>
+<script src="../resources/strophe/strophe.flxhr.min.js"></script>
+<script src="client.js"></script>
+</body>
+</html>

Added: 
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.js
URL: 
http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.js?rev=949579&view=auto
==============================================================================
--- 
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.js
 (added)
+++ 
mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/examples/client/client.js
 Sun May 30 21:16:46 2010
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+var server;
+var port;
+var jid;
+var password;
+var connection;
+
+var connectionStatuses = {};
+connectionStatuses[Strophe.Status.ERROR] = "ERROR";
+connectionStatuses[Strophe.Status.CONNECTING] = "CONNECTING";
+connectionStatuses[Strophe.Status.CONNFAIL] = "CONNFAIL";
+connectionStatuses[Strophe.Status.AUTHENTICATING] = "AUTHENTICATING";
+connectionStatuses[Strophe.Status.AUTHFAIL] = "AUTHFAIL";
+connectionStatuses[Strophe.Status.CONNECTED] = "CONNECTED";
+connectionStatuses[Strophe.Status.DISCONNECTED] = "DISCONNECTED";
+connectionStatuses[Strophe.Status.DISCONNECTING] = "DISCONNECTING";
+connectionStatuses[Strophe.Status.ATTACHED] = "ATTACHED";
+
+$(document).ready(function() {
+       // this is needed by flXHR to automatically include its dependencies
+       window.flensed = {base_path:"../resources/flxhr/"};
+});
+
+$("#connect").click(function() {
+       $("#connect-form").hide();
+       $("#logger").show();
+       connect();
+});
+
+function formatTime(val) {
+       return val < 10 ? "0" + val : val;
+}
+
+function log(msg) {
+       var now = new Date();
+       var hours = formatTime(now.getHours());
+       var minutes = formatTime(now.getMinutes());
+       var seconds = formatTime(now.getSeconds());
+       $("#logger").append("[" + hours + ":" + minutes + ":" + seconds + "] " 
+ msg + "<br/>");
+}
+
+function connect() {
+       server = $("#server").val();
+       port = $("#port").val();
+       jid = $("#jid").val();
+       password = $("#password").val();
+       log("Connecting to <b>" + server + ":" + port + "</b> as <b>" + jid + 
"</b>...");
+       
+       connection = new Strophe.Connection("http://"; + server + ":" + port + 
"/");
+       connection.connect(jid, password, function(status) {
+               log("Connection status: " + connectionStatuses[status]);
+       });
+}
\ No newline at end of file


Reply via email to