Skip to content

Commit 735f493

Browse files
authored
Merge pull request #1 from XDex/binary-frames
Binary codec support (including sc-codec-min-bin)
2 parents cbd110c + cd0fa3c commit 735f493

File tree

14 files changed

+434
-400
lines changed

14 files changed

+434
-400
lines changed

.idea/modules/SocketclusterClientJava.iml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/SocketclusterClientJava_main.iml

Lines changed: 9 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/SocketclusterClientJava_test.iml

Lines changed: 9 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Java and Android Socketcluster Client
22
=====================================
33

4+
This SocketCluster Java/Android Client fork has the following differences from upstream:
5+
- [Jackson](https://github.com/FasterXML/jackson) JSON parser is used, instead of [JSON-java](https://github.com/stleary/JSON-java)
6+
- [SocketCluster Minimal binary (sc-codec-min-bin) codec](https://github.com/SocketCluster/sc-codec-min-bin) support
7+
- Underlying [nv-websocket-client](https://github.com/TakahikoKawasaki/nv-websocket-client) has been updated to the latest version
8+
- Breaking: callback params now have Jackson `JsonNode` types, instead of upstream's `Object`
9+
10+
**Important Notes:** Due to using `jackson-databing` this library is significantly bigger in size than upstream (~2 Mb), so if binary codec support is not needed, consider using upstream instead.
11+
412
Overview
513
--------
614
This client provides following functionality
@@ -9,37 +17,26 @@ This client provides following functionality
917
- Automatic reconnection
1018
- Pub/sub
1119
- Authentication (JWT)
20+
- Binary codec support (`sc-codec-min-bin` included out-of-the-box)
1221

1322
License
1423
-------
1524
Apache License, Version 2.0
1625

1726
Gradle
1827
------
19-
For java
2028

2129
```Gradle
22-
dependencies {
23-
compile 'io.github.sac:SocketclusterClientJava:1.7.4'
30+
repositories {
31+
jcenter()
32+
maven { url "https://jitpack.io" }
2433
}
25-
```
26-
for sample java examples visit [Java Demo](https://github.com/sacOO7/socketcluster-client-testing/tree/master/src/main/java)
27-
28-
For android
29-
30-
```Gradle
31-
compile ('io.github.sac:SocketclusterClientJava:1.7.4'){
32-
exclude group :'org.json', module: 'json'
34+
dependencies {
35+
implementation 'com.github.XDex:socketcluster-client-java:2.0.0'
3336
}
3437
```
35-
for sample android demo visit [Android Demo](https://github.com/sacOO7/socketcluster-android-demo)
36-
3738

38-
[ ![Download](https://api.bintray.com/packages/sacoo7/Maven/socketcluster-client/images/download.svg) ](https://bintray.com/sacoo7/Maven/socketcluster-client/_latestVersion)
39-
40-
<!---
41-
Download [latest jar dependency](https://github.com/sacOO7/socketcluster-client-java/blob/master/out/artifacts/SocketclusterClientJava_main_jar/SocketclusterClientJava_main.jar?raw=true)
42-
-->
39+
[Download JAR](https://api.bintray.com/packages/sacoo7/Maven/socketcluster-client/images/download.svg)
4340

4441
Description
4542
-----------
@@ -194,6 +191,20 @@ The object received can be String, Boolean, Long or JSONObject.
194191

195192
```
196193

194+
Codecs
195+
------
196+
197+
Custom binary [SocketCluster codecs](https://github.com/SocketCluster/socketcluster#custom-codecs) are supported.
198+
Support for [sc-codec-min-bin](https://github.com/SocketCluster/sc-codec-min-bin) is included out-of-the-box.
199+
200+
To enable a binary codec, just set it as follows on the SocketCluster `Socket`:
201+
202+
```java
203+
socket.setCodec(new MinBinCodec());
204+
```
205+
206+
Custom binary codecs must implement the `SocketClusterCodec` interface.
207+
197208
Implementing Pub-Sub via channels
198209
---------------------------------
199210

build.gradle

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allprojects {
1616
}
1717

1818
group 'io.github.sac'
19-
version '1.7.4'
19+
version '2.0.0'
2020

2121

2222
allprojects {
@@ -28,6 +28,10 @@ allprojects {
2828
apply plugin: 'maven-publish'
2929
}
3030

31+
task wrapper(type: Wrapper) {
32+
gradleVersion = '4.6'
33+
}
34+
3135
task sourceJar(type: Jar) {
3236
classifier = 'sources'
3337
from sourceSets.main.allJava
@@ -38,13 +42,19 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
3842
from javadoc.destinationDir
3943
}
4044

45+
jar {
46+
from {
47+
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
48+
}
49+
}
50+
4151
publishing {
4252
publications {
4353
MyPublication(MavenPublication) {
4454
from components.java
4555
groupId 'io.github.sac'
4656
artifactId 'SocketclusterClientJava'
47-
version '1.7.4'
57+
version '2.0.0'
4858

4959
artifact sourceJar {
5060
classifier "sources"
@@ -71,15 +81,15 @@ bintray{
7181
publicDownloadNumbers = true
7282

7383
version {
74-
name = '1.7.4'
75-
desc = 'Added method to Connect asynchronously with server'
76-
vcsTag = '1.7.4'
84+
name = '2.0.0'
85+
desc = 'Switched to Jackson and implemented sc-min-bin codec support'
86+
vcsTag = '2.0.0'
7787
}
7888

7989
}
8090
}
8191

8292
dependencies {
83-
compile 'com.neovisionaries:nv-websocket-client:1.30'
84-
compile group: 'org.json', name: 'json', version: '20090211'
93+
implementation 'com.neovisionaries:nv-websocket-client:2.3'
94+
implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.15'
8595
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Nov 08 13:06:24 IST 2016
1+
#Thu Mar 29 19:55:57 EEST 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

src/main/java/META-INF/MANIFEST.MF

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/main/java/Main.java

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)