Skip to content

Commit

Permalink
renaming further project details
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottox committed Dec 24, 2011
1 parent 8af86ed commit 49aac36
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="socket.io-java-client"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/io.socket/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value=""/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/socket.io-java-client/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/io.socket}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/socket.io-java-client}"/>
</launchConfiguration>
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/io.socket.launch</value>
<value>&lt;project&gt;/.externalToolBuilders/socket.io-java-client.launch</value>
</dictionary>
</arguments>
</buildCommand>
Expand Down
28 changes: 14 additions & 14 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

# Socket.IO-Client for Java

io.socket is a simple implementation of [socket.io](http://socket.io) for Java.
socket.io-java-client is a simple implementation of [socket.io](http://socket.io) for Java.

It uses [Java-WebSocket](https://github.com/TooTallNate/Java-WebSocket) as transport backend, but it's easy
to write your own transport. See description below.

The API is inspired by [java-socket.io.client](https://github.com/benkay/java-socket.io.client) but as the license
of this project was unclear and it had some nasty bugs, I decided to write io.socket from the scratch.
of this project was unclear and it had some nasty bugs, I decided to write socket.io-java-client from the scratch.

Features:

* __transparent reconnecting__ - The API cares about re-establishing the connection to the server
when the transport is interrupted.
* __easy to use API__ - implement an interface, instantiate a class - you're done.
* __output buffer__ - send data while the transport is still connecting. No problem, io.socket handles that.
* __output buffer__ - send data while the transport is still connecting. No problem, socket.io-java-client handles that.

## How to use

Using io.socket is quite simple. But lets see:
Using socket.io-java-client is quite simple. But lets see:

``` java
// Initialise a socket:
Expand Down Expand Up @@ -66,43 +66,43 @@ Using io.socket is quite simple. But lets see:
socket.emit("hello", new JSONObject().put("msg", "Hello Socket.io! :D"));
```

For further informations, read the [Javadoc](http://s01.de/~tox/hgexport/io.socket/).
For further informations, read the [Javadoc](http://s01.de/~tox/hgexport/socket.io-java-client/).

* [Class SocketIO](http://s01.de/~tox/hgexport/io.socket/io/socket/SocketIO.html)
* [Interface IOCallback](http://s01.de/~tox/hgexport/io.socket/io/socket/IOCallback.html)
* [Class SocketIO](http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/SocketIO.html)
* [Interface IOCallback](http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/IOCallback.html)

## What is the architecture?
Read this if you want to investigate in io.socket.
Read this if you want to investigate in socket.io-java-client.

![Schema](https://github.com/Gottox/io.socket/raw/master/doc/schema.png)
![Schema](https://github.com/Gottox/socket.io-java-client/raw/master/doc/schema.png)

### What is the SocketIO class?

SocketIO is the API frontend. You can use this to connect to multiple hosts. If an
*IOConnection* object exists for a certian host, it will be reused as the
socket.io specs state.

[Javadoc](http://s01.de/~tox/hgexport/io.socket/io/socket/SocketIO.html)
[Javadoc](http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/SocketIO.html)

### What is the IOConnection class?

This class is used to hold a connection to a socket.io server. It handles calling
callback functions of the corresponding *SocketIO* and reconnecting if the connection
is shut down ungracefully.

[Javadoc](http://s01.de/~tox/hgexport/io.socket/io/socket/IOConnection.html)
[Javadoc](http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/IOConnection.html)

### What is the IOTransport interface?

This interface describes a connection to a host. The implementation can be fairly minimal,
as *IOConnection* does most of the work for you. Reconnecting, errorhandling, etc... is
handled by *IOConnection*.

[Javadoc](http://s01.de/~tox/hgexport/io.socket/io/socket/IOTransport.html)
[Javadoc](http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/IOTransport.html)

## How to implement a transport?

An example can be found in [WebsocketTransport.java](http://github.com/Gottox/io.socket/blob/master/src/io/socket/transports/WebsocketTransport.java)
An example can be found in [WebsocketTransport.java](http://github.com/Gottox/socket.io-java-client/blob/master/src/io/socket/transports/WebsocketTransport.java)

Create a class implementing the IOTransport interface.

Expand Down Expand Up @@ -145,7 +145,7 @@ session.

### IOConnection

Ok, now we know when our functions are called. But how do we tell io.socket to process messages we get?
Ok, now we know when our functions are called. But how do we tell socket.io-java-client to process messages we get?
The provided IOConnection does the trick.

#### IOConnection.transportConnect()
Expand Down
45 changes: 35 additions & 10 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="io.socket">
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="socket.io-java-client">
<property environment="env"/>
<property name="treckme.location" value="../treckme"/>
<property name="ECLIPSE_HOME" value="../../../../../Applications/eclipse"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="io.socket.classpath">
<path id="socket.io-java-client.classpath">
<pathelement location="bin"/>
<pathelement location="lib/json-org.jar"/>
<pathelement location="lib/WebSocket.jar"/>
Expand All @@ -13,13 +20,11 @@
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy includeemptydirs="false" todir="bin">
<fileset dir="examples">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
Expand All @@ -32,19 +37,39 @@
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac includeantruntime="false" debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="io.socket.classpath"/>
<classpath refid="socket.io-java-client.classpath"/>
</javac>
<javac includeantruntime="false" debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
<src path="examples"/>
<classpath refid="io.socket.classpath"/>
<classpath refid="socket.io-java-client.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects">
<ant antfile="build.xml" dir="${treckme.location}" inheritAll="false" target="clean"/>
<ant antfile="build.xml" dir="${treckme.location}" inheritAll="false" target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
</target>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
<target name="Test">
<java classname="Test" failonerror="true" fork="yes">
<classpath refid="io.socket.classpath"/>
<classpath refid="socket.io-java-client.classpath"/>
</java>
</target>
</project>

0 comments on commit 49aac36

Please sign in to comment.