Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Java WebSockets
===============
[![Build Status](https://travis-ci.org/marci4/Java-WebSocket-Dev.svg?branch=master)](https://travis-ci.org/marci4/Java-WebSocket-Dev) [![Clojars Project](https://img.shields.io/clojars/v/org.java-websocket/java-websocket.svg)](https://clojars.org/org.java-websocket/java-websocket)

[![Build Status](https://travis-ci.org/marci4/Java-WebSocket-Dev.svg?branch=master)](https://travis-ci.org/marci4/Java-WebSocket-Dev)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.java-websocket/Java-WebSocket/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.java-websocket/Java-WebSocket)

This repository contains a barebones WebSocket server and client implementation
written in 100% Java. The underlying classes are implemented `java.nio`, which allows for a
Expand Down Expand Up @@ -36,37 +36,30 @@ will create the javadoc of this library at ```doc/``` and build the library itse
The ant targets are: ```compile```, ```jar```, ```doc``` and ```clean```

### Maven
To use maven add this repository to your pom.xml:
```xml
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
```
Also add this dependency to your pom.xml:
To use maven add this dependency to your pom.xml:
```xml
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>java-websocket</artifactId>
<version>1.3.3</version>
<artifactId>Java-WebSocket</artifactId>
<version>1.3.4</version>
</dependency>
```

### Gradle
To use Gradle add this repository to your repositories list :
To use Gradle add the maven central repository to your repositories list :
```xml
maven { url "http://clojars.org/repo" }
mavenCentral()
```
Then you can just add the latest version to your build.
```xml
compile "org.java-websocket:java-websocket:1.3.3"
compile "org.java-websocket:Java-WebSocket:1.3.4"
```


### Leiningen

``` bash
[org.java-websocket/java-websocket "1.3.3"]
[org.java-websocket/java-websocket "1.3.4"]
```

Running the Examples
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
}

group = 'org.java_websocket'
version = '1.3.3'
version = '1.3.4'
sourceCompatibility = 1.6
targetCompatibility = 1.6

Expand Down
111 changes: 58 additions & 53 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.java-websocket</groupId>
<artifactId>java-websocket</artifactId>
<artifactId>Java-WebSocket</artifactId>
<packaging>jar</packaging>
<version>1.3.3</version>
<name>java-websocket</name>
<version>1.3.4</version>
<name>Java-WebSocket</name>
<description>A barebones WebSocket client and server implementation written 100% in Java</description>
<url>https://github.com/TooTallNate/Java-WebSocket</url>
<licenses>
Expand All @@ -16,60 +16,68 @@
<scm>
<url>https://github.com/TooTallNate/Java-WebSocket</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<sourceDirectory>src\main\java</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>resources</directory>
</testResource>
</testResources>
<directory>target</directory>
<outputDirectory>target\classes</outputDirectory>
<plugins/>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>clojars</id>
<url>https://clojars.org/repo/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<dependencyManagement>
<dependencies/>
</dependencyManagement>
<dependencies/>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<name>Nathan Rajlich</name>
<url>https://github.com/TooTallNate</url>
<email>nathan@tootallnate.net</email>
</developer>
<developer>
<name>David Rohmer</name>
<url>https://github.com/Davidiusdadi</url>
<email>rohmer.david@gmail.com</email>
</developer>
<developer>
<name>Marcel Prestel</name>
<url>https://github.com/marci4</url>
Expand All @@ -78,7 +86,4 @@
</developers>
</project>

<!-- This file was autogenerated by Leiningen.
Please do not edit it directly; instead edit project.clj and regenerate it.
It should not be considered canonical data. For more information see
https://github.com/technomancy/leiningen -->

2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject org.java-websocket/java-websocket "1.3.3"
(defproject org.java-websocket/java-websocket "1.3.4"
:description "A barebones WebSocket client and server implementation written 100% in Java"
:url "https://github.com/TooTallNate/Java-WebSocket"
:scm {:name "git"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/java_websocket/AbstractWebSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public int getConnectionLostTimeout() {

/**
* Setter for the interval checking for lost connections
* A value >= 0 results in the check to be deactivated
* A value lower or equal 0 results in the check to be deactivated
*
* @param connectionLostTimeout the interval in seconds
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/java_websocket/SSLSocketChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

/**
* A class that represents an SSL/TLS peer, and can be extended to create a client or a server.
* <p/>
*
* It makes use of the JSSE framework, and specifically the {@link SSLEngine} logic, which
* is described by Oracle as "an advanced API, not appropriate for casual use", since
* it requires the user to implement much of the communication establishment procedure himself.
* More information about it can be found here: http://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#SSLEngine
* <p/>
*
* {@link SSLSocketChannel} implements the handshake protocol, required to establish a connection between two peers,
* which is common for both client and server and provides the abstract {@link SSLSocketChannel#read(ByteBuffer)} and
* {@link SSLSocketChannel#write(ByteBuffer)} (String)} methods, that need to be implemented by the specific SSL/TLS peer
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/java_websocket/framing/CloseFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ public CloseFrame() {
setCode(CloseFrame.NORMAL);
}

public void setCode(int code) {
/**
* Set the close code for this close frame
* @param code the close code
*/
public void setCode(int code) {
this.code = code;
// CloseFrame.TLS_ERROR is not allowed to be transfered over the wire
if (code == CloseFrame.TLS_ERROR) {
Expand All @@ -143,6 +147,10 @@ public void setCode(int code) {
updatePayload();
}

/**
* Set the close reason for this close frame
* @param reason the reason code
*/
public void setReason(String reason) {
if (reason == null) {
reason = "";
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/java_websocket/framing/ControlFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public abstract class ControlFrame extends FramedataImpl1 {

/**
* Class to represent a control frame
* @param opcode the opcode to use
*/
public ControlFrame( Opcode opcode ) {
super( opcode );
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/java_websocket/framing/DataFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public abstract class DataFrame extends FramedataImpl1 {

/**
* Class to represent a data frame
* @param opcode the opcode to use
*/
public DataFrame(Opcode opcode) {
super(opcode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class FramedataImpl1 implements Framedata {
/**
* Check if the frame is valid due to specification
*
* @throws InvalidDataException
* @throws InvalidDataException thrown if the frame is not a valid frame
*/
public abstract void isValid() throws InvalidDataException;

Expand Down