Skip to content

Commit

Permalink
added content from autobahn.ws, updated layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Goedde committed Mar 23, 2014
1 parent 60c9f9a commit 7801342
Show file tree
Hide file tree
Showing 18 changed files with 494 additions and 9 deletions.
22 changes: 22 additions & 0 deletions autobahnandroid.sublime.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"folders":
[
{
"follow_symlinks": false,
"name": "Autobahn Android",
"path": ".",
"folder_exclude_patterns": ["build", "dist", "*.egg-info"],
"file_exclude_patterns": ["*.pyc"]
}
],
"settings":
{
"tab_size": 3,
"translate_tabs_to_spaces": true,
"use_tab_stops": true,
"detect_indentation": false,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
"default_encoding": "UTF-8"
}
}
Binary file added doc/_static/autobahn_eclipse0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/autobahn_eclipse1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/autobahn_eclipse2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/autobahn_eclipse3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/_static/autobahn_eclipse4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions doc/_templates/side-secondary.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<h3>Useful Links</h3>
<ul>
<li><a href="http://autobahn.ws">The Autobahn Project</a></li>
<li><a href=" https://groups.google.com/forum/#!forum/autobahnws">Autobahn @ Google Groups</a></li>
<li><a href="https://github.com/tavendo/AutobahnAndroid">Autobahn @ GitHub</a></li>
<li><a href="https://github.com/tavendo/AutobahnAndroid/issues">Issue Tracker</a></li>
<li>IRC: <em>#autobahn</em> on <em>chat.freenode.net</em></li>
</ul>
6 changes: 6 additions & 0 deletions doc/_templates/sidetoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h4><a href="{{ pathto('table_of_contents') }}">{{ _('Table Of Contents') }}</a></h4>

<h4><a href="{{ pathto('genindex') }}">Index</a></h4>

<h3>Page Contents</h3>
{{ toc }}
5 changes: 5 additions & 0 deletions doc/_templates/stay_informed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3>Stay Informed</h3>
<p>
<iframe src="http://ghbtns.com/github-btn.html?user=autobahnws&type=follow" allowtransparency="true" frameborder="0" scrolling="0" width="165" height="20">
</iframe>
</p>
2 changes: 2 additions & 0 deletions doc/_themes/kr/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{% endif %}
<link media="only screen and (max-device-width: 480px)" href="{{
pathto('_static/small_flask.css', 1) }}" type= "text/css" rel="stylesheet" />
<link rel="stylesheet" href="{{
pathto('_static/autobahn.css', 1) }}" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
{% endblock %}
{%- block relbar2 %}{% endblock %}
Expand Down
25 changes: 25 additions & 0 deletions doc/_themes/kr/previous_next.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

<ul>

{%- if prev %}
<li>
<h4>
Previous:
<a href="{{ prev.link|e }}" title="{{ _('previous chapter')}}">
{{ prev.title }}
</a>
</h4>
</li>
{%- endif %}
{%- if next %}
<li>
<h4>
Next:
<a href="{{ next.link|e }}" title="{{ _('next chapter')}}">
{{ next.title }}
</a>
</h4>
</li>
{%- endif %}

</ul>
47 changes: 47 additions & 0 deletions doc/_themes/kr/static/autobahn.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
div.topnav.container {
font-size: 17px;
background-color: #eee;
padding: 0.4em 0.5em;
margin: 0 0 0.8em;
text-align: center;
}

div.topnav.container > a {
margin-right: 10px;

}

div.topnav.container > a:last-of-type {
margin-right: 0;
}

div.topnav.container > a > em {
font-style: normal;
}

.function {
background-color: #E1E9F8;
border: 1px solid #ddd;
padding: 5px;
}

.attribute {
background-color: #E1E9F8;
border: 1px solid #ddd;
padding: 5px;
}


/* fix code blocks shrinking to code width when using line numbers */
/* -- still expanding instead of overflow -- */

table.highlighttable {
width: 100%;
}


.legacynotice {
background-color: #FF9147;
padding: 1em;
}

7 changes: 4 additions & 3 deletions doc/_themes/kr/static/flasky.css_t
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
/* -- page layout ----------------------------------------------------------- */

body {
font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro';
font-size: 17px;
font-family: 'Bell MT', Georgia, serif;
font-style: normal;
font-size: 16px;
background-color: white;
color: #000;
margin: 0;
Expand Down Expand Up @@ -442,4 +443,4 @@ a:hover tt {

.revsys-inline {
display: none!important;
}
}
19 changes: 16 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@
#html_sidebars = {}

html_sidebars = {
'index': ['side-primary.html', 'searchbox.html'],
'**': ['side-secondary.html', 'localtoc.html',
'relations.html', 'searchbox.html']
# 'index': ['side-primary.html', 'searchbox.html'],
'**': ['side-secondary.html', 'stay_informed.html', 'sidetoc.html',
'previous_next.html', 'searchbox.html' ]
}

# Additional templates that should be rendered to pages, maps page names to
Expand Down Expand Up @@ -284,3 +284,16 @@
'org.springframework' : ('http://static.springsource.org/spring/docs/3.1.x/javadoc-api/', 'javadoc'),
'org.springframework.data.redis' : ('http://static.springsource.org/spring-data/data-redis/docs/current/api/', 'javadoc')
}



rst_epilog = """
.. |ab| replace:: **Autobahn**\|Android
"""

rst_prolog = """
.. container:: topnav
:doc:`Overview </index>` :doc:`Getting Started </gettingstarted>` :doc:`/examples` :doc:`API Reference </_gen/packages>`
"""
28 changes: 28 additions & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Examples
=========

.. container:: legacynotice

|ab| implements version 1 of WAMP.

This is incompatible with version 2 of WAMP which is already implemented in Autobahn|Python as well as Autobahn|JS

Migration of |ab| to WAMP v2 is coming, but we cannot guarantee a release date.


Tutorials and examples are here to showcase specific areas of Autobahn|Android . They include self-contained, fully working code, but may not cover all features available. For the latter, please consult the :doc:`API reference </_gen/packages>`.

All tutorials and examples are hosted on `GitHub <https://github.com/tavendo/AutobahnAndroid/tree/master/Demo>`_.

WebSocket Programming
------------------------

* `Hello world: WebSocket Echo <https://github.com/tavendo/AutobahnAndroid/tree/master/Demo/EchoClient>`_
* `Broadcasting over WebSocket <https://github.com/tavendo/AutobahnAndroid/tree/master/Demo/BroadcastClient>`_
* `AutobahnTestsuite client <https://github.com/tavendo/AutobahnAndroid/tree/master/Demo/TestSuiteClient>`_

WAMP Programming
-------------------

* `Remote Procedure Calls with AutobahnAndroid <https://github.com/tavendo/AutobahnAndroid/tree/master/Demo/SimpleRpc>`_
* `Publish & Subscribe with AutobahnAndroid <https://github.com/tavendo/AutobahnAndroid/tree/master/Demo/SimplePubSub>`_
156 changes: 156 additions & 0 deletions doc/gettingstarted.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@

Getting Started
===============

.. container:: legacynotice

|ab| implements version 1 of WAMP.

This is incompatible with version 2 of WAMP which is already implemented in Autobahn|Python as well as Autobahn|JS

Migration of |ab| to WAMP v2 is coming, but we cannot guarantee a release date.

This short intro will get you started with |ab| in no time:

* Installation
* Your first Client
* Where to go now


Installation
------------

Requirements
++++++++++++

|ab| is written against the Android 2.2 platform (= API level 8). You can use it with projects built against that version or higher.

|ab| depends on Jackson, a high-performance JSON processor. AutobahnAndroid is known to work with Jackson 1.8 and 1.9.


Set Compiler Level
++++++++++++++++++

Make sure the Java compiler compliance level is set to (at least) 1.6 in your project settings:

.. image:: /_static/autobahn_eclipse0.png


Add JARs to your project
++++++++++++++++++++++++

To use |ab| , you will need 3 JARs:

* `AutobahnAndroid <https://autobahn.s3.amazonaws.com/android/autobahn-0.5.0.jar>`_
* `Jackson Core <http://repository.codehaus.org/org/codehaus/jackson/jackson-core-asl/1.9.7/jackson-core-asl-1.9.7.jar>`_
* `Jackson Mapper <http://repository.codehaus.org/org/codehaus/jackson/jackson-mapper-asl/1.9.7/jackson-mapper-asl-1.9.7.jar>`_

You can also get a `complete bundle <https://autobahn.s3.amazonaws.com/android/autobahn-0.5.0.zip>`_ of AutobahnAndroid and Jackson JARs.

. note:: |ab| is also available as `source code <https://github.com/tavendo/AutobahnAndroid>`_ on GitHub.

Put the 3 above JARs into your project's libs folder

.. image:: /_static/autobahn_eclipse1.png

and add the JARs to the project's build path

.. image:: /_static/autobahn_eclipse2.png


Set App Permissions
+++++++++++++++++++

Make sure the Manifest for your application contains the android.permission.INTERNET

.. code-block:: java
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...>
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
<application ...>
</application>
</manifest>
.. image:: /_static/autobahn_eclipse3.png


Your first Client
+++++++++++++++++

Create a new Android project and replace the main activity code with the following:

.. code-block:: java
package de.tavendo.test1;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import de.tavendo.autobahn.WebSocketConnection;
import de.tavendo.autobahn.WebSocketException;
import de.tavendo.autobahn.WebSocketHandler;
public class Test1Activity extends Activity {
private static final String TAG = "de.tavendo.test1";
private final WebSocketConnection mConnection = new WebSocketConnection();
private void start() {
final String wsuri = "ws://192.168.1.132:9000";
try {
mConnection.connect(wsuri, new WebSocketHandler() {
@Override
public void onOpen() {
Log.d(TAG, "Status: Connected to " + wsuri);
mConnection.sendTextMessage("Hello, world!");
}
@Override
public void onTextMessage(String payload) {
Log.d(TAG, "Got echo: " + payload);
}
@Override
public void onClose(int code, String reason) {
Log.d(TAG, "Connection lost.");
}
});
} catch (WebSocketException e) {
Log.d(TAG, e.toString());
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
start();
}
}
Now start a WebSocket echo server on some host and adjust line 18 for the IP of the host.

.. note:: You can use any WebSocket server that implements WebSocket RFC6455 or at least Hybi-10+. A WebSocket server that only implements Hixie-76 will not work.

.. note:: For this demo, on the WebSocket server you will need to implement "echo", so that any message sent to it is simply echo'ed back to the client. I.e. you can use the server provided with the WebSocket Echo server example that comes with Autobahn|Python .

Build and run the app. You should see the following in the Android device logcat:

.. image:: /_static/autobahn_eclipse4.png


Where to go now
+++++++++++++++

Now that you are up and running, check out the :doc:`examples` available or the :doc:`API reference </_gen/packages>`.
Loading

0 comments on commit 7801342

Please sign in to comment.