Skip to content

Commit

Permalink
Updated Java-Websocket to 1.3.6 to support receiving fragments with t…
Browse files Browse the repository at this point in the history
…he onMessage method
  • Loading branch information
jebej committed Nov 19, 2017
1 parent abfa30d commit e995b23
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ When you are done, do not forget to `delete` the clients and/or servers.
See the `EchoServer.m` and `SimpleClient.m` files in the `examples` folder for an implementation example. A good resource on classes is the [MATLAB object-oriented documentation](http://www.mathworks.com/help/matlab/object-oriented-programming.html).

Example
------
------------
The example is an echo server, it returns to the client whatever was received.

Run the echo server by making sure that the file is on the MATLAB path and executing
Expand Down Expand Up @@ -91,7 +91,7 @@ clear server;
```

SSL / WebSocket Secure (wss)
-------
------------

To enable SSL, you must first have a certificate. A self-signed key store can be generated with the java `keytool`, but you should always use a valid certificate in production. From there, open the server by passing the location of the store, the store password, and the key password. With the EchoServer, for example:

Expand Down Expand Up @@ -119,14 +119,21 @@ Message received:
hi, this communication is secured!
```

Building the Java JAR
------------

To build the `jar` file yourself, it is recommended to use Apache Maven. Maven will automatically take care of downloading Java-WebSocket and neatly package everything into a single file (an "uber jar").

Once the `mvn` command is on your path, simply `cd` to the `matlab-websocket` folder and execute `mvn package`.

Acknowledgments
-------
------------

This work was inspired by a websocket client MATLAB implementation: [matlab-websockets](https://github.com/mingot/matlab-websockets).

It relies on the [Java-WebSocket](https://github.com/TooTallNate/Java-WebSocket) library.

License
-------
------------

The code in this repository is licensed under the MIT license. See the `LICENSE` file for details.
Binary file removed jar/matlab-websocket-1.3.jar
Binary file not shown.
Binary file added jar/matlab-websocket-1.4.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/matlab-websocket/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>io.github.jebej.matlabwebsocket</groupId>
<artifactId>matlab-websocket</artifactId>
<packaging>jar</packaging>
<version>1.3</version>
<version>1.4</version>

<name>matlab-websocket</name>
<url>http://maven.apache.org</url>
Expand Down Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.3.4</version>
<version>1.3.6</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void onMessage( String message ) {
}
}

// Method handler when a byte message has been received from the client
// Method handler when a byte message has been received by the client
@Override
public void onMessage( ByteBuffer blob ) {
MatlabEvent matlab_event = new MatlabEvent( this, blob );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onOpen( WebSocket conn, ClientHandshake handshake ) {
}
}

// Method handler when a text message has been received from the client
// Method handler when a text message has been received by the server
@Override
public void onMessage( WebSocket conn, String message ) {
MatlabEvent matlab_event = new MatlabEvent( this, conn, message );
Expand All @@ -43,7 +43,7 @@ public void onMessage( WebSocket conn, String message ) {
}
}

// Method handler when a binary message has been received from the client
// Method handler when a binary message has been received by the server
@Override
public void onMessage( WebSocket conn, ByteBuffer blob ) {
MatlabEvent matlab_event = new MatlabEvent( this, conn, blob );
Expand Down

0 comments on commit e995b23

Please sign in to comment.