Skip to content

Commit a8e9594

Browse files
proggen-comdaansystemsproggen-com
authored
Event handling refactor and fix handling of pusher_internal:subscription_count event (#336)
* handle pusher_internal:subscription_count event internally, but pass it on to the handlers. Also create the public pusher:subscription_count event * - refactor pusher event handling - formatting - fix subscriptioncount * formatting * update changelog and readme Co-authored-by: Niek <[email protected]> Co-authored-by: proggen-com <[email protected]>
1 parent 5c484c4 commit a8e9594

File tree

94 files changed

+2331
-2150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2331
-2150
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ name: pusher-websocket-java CI
33
on:
44
pull_request:
55
push:
6-
branches: [master, main]
6+
branches: [ master, main ]
77

88
jobs:
99
build:
1010
runs-on: ubuntu-20.04
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
java-version: [8, 9, 10, 11, 17, 18]
14+
java-version: [ 8, 9, 10, 11, 17, 18 ]
1515

1616
steps:
1717
- uses: actions/[email protected]

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# pusher-websocket-java changelog
22

3+
### Version 2.4.1 - 13th Sep 2022
4+
* Refactoring and code cleanup of event handling in the SDK
5+
* Fixes subscription_count events
6+
37
### Version 2.4.0 - 15th July 2022
48
* Add support for Subscription count events
59

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The pusher-java-client is available in Maven Central.
7474
<dependency>
7575
<groupId>com.pusher</groupId>
7676
<artifactId>pusher-java-client</artifactId>
77-
<version>2.4.0</version>
77+
<version>2.4.1</version>
7878
</dependency>
7979
</dependencies>
8080
```
@@ -83,7 +83,7 @@ The pusher-java-client is available in Maven Central.
8383

8484
```groovy
8585
dependencies {
86-
compile 'com.pusher:pusher-java-client:2.4.0'
86+
compile 'com.pusher:pusher-java-client:2.4.1'
8787
}
8888
```
8989

build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ targetCompatibility = "1.8"
3232

3333
ext.sharedManifest = manifest {
3434
attributes(
35-
'Created-By' : 'Pusher',
36-
'Implementation-Vendor' : 'Pusher',
37-
'Implementation-Title' : 'Pusher Java Websocket API Example',
38-
'Implementation-Version': version,
39-
'Package' : 'com.pusher.client.example',
40-
'Main-Class' : 'com.pusher.client.example.ExampleApp'
35+
'Created-By': 'Pusher',
36+
'Implementation-Vendor': 'Pusher',
37+
'Implementation-Title': 'Pusher Java Websocket API Example',
38+
'Implementation-Version': version,
39+
'Package': 'com.pusher.client.example',
40+
'Main-Class': 'com.pusher.client.example.ExampleApp'
4141
)
4242
}
4343

@@ -58,8 +58,8 @@ dependencies {
5858

5959
processResources {
6060
filter(ReplaceTokens, tokens: [
61-
version: project.version
62-
] )
61+
version: project.version
62+
])
6363
}
6464

6565

@@ -86,7 +86,7 @@ jar {
8686
}
8787
}
8888

89-
task fatJar(type: Jar, dependsOn:configurations.runtimeClasspath) {
89+
task fatJar(type: Jar, dependsOn: configurations.runtimeClasspath) {
9090
manifest = project.manifest {
9191
from sharedManifest
9292
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.pusher.client;
22

3-
43
/**
5-
* @deprecated
6-
* Please use {@link com.pusher.client.ChannelAuthorizer}
4+
* @deprecated Please use {@link com.pusher.client.ChannelAuthorizer}
75
*/
86
@Deprecated
9-
public interface Authorizer extends ChannelAuthorizer {}
7+
public interface Authorizer extends ChannelAuthorizer {
8+
}

src/main/java/com/pusher/client/ChannelAuthorizer.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@
1212
* </p>
1313
*/
1414
public interface ChannelAuthorizer {
15-
1615
/**
1716
* Called when a channel subscription is to be authorized.
1817
*
19-
* @param channelName
20-
* The name of the channel to be authorized.
21-
* @param socketId
22-
* A unique socket connection ID to be used with the
23-
* authorization. This uniquely identifies the connection that
24-
* the subscription is being authorized for.
18+
* @param channelName The name of the channel to be authorized.
19+
* @param socketId A unique socket connection ID to be used with the
20+
* authorization. This uniquely identifies the connection that
21+
* the subscription is being authorized for.
2522
* @return A channel authorization token.
26-
* @throws AuthorizationFailureException
27-
* if the authorization fails.
23+
* @throws AuthorizationFailureException if the authorization fails.
2824
*/
2925
String authorize(String channelName, String socketId) throws AuthorizationFailureException;
3026
}

src/main/java/com/pusher/client/Client.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,38 @@
1212

1313
public interface Client {
1414
Connection getConnection();
15+
1516
void connect();
17+
1618
void connect(final ConnectionEventListener eventListener, ConnectionState... connectionStates);
19+
1720
void disconnect();
21+
1822
Channel subscribe(final String channelName);
23+
1924
Channel subscribe(final String channelName, final ChannelEventListener listener, final String... eventNames);
25+
2026
PrivateChannel subscribePrivate(final String channelName);
21-
PrivateChannel subscribePrivate(final String channelName, final PrivateChannelEventListener listener,
22-
final String... eventNames);
27+
28+
PrivateChannel subscribePrivate(
29+
final String channelName,
30+
final PrivateChannelEventListener listener,
31+
final String... eventNames
32+
);
33+
2334
PresenceChannel subscribePresence(final String channelName);
24-
PresenceChannel subscribePresence(final String channelName, final PresenceChannelEventListener listener,
25-
final String... eventNames);
35+
36+
PresenceChannel subscribePresence(
37+
final String channelName,
38+
final PresenceChannelEventListener listener,
39+
final String... eventNames
40+
);
41+
2642
void unsubscribe(final String channelName);
43+
2744
Channel getChannel(String channelName);
45+
2846
PrivateChannel getPrivateChannel(String channelName);
47+
2948
PresenceChannel getPresenceChannel(String channelName);
3049
}

0 commit comments

Comments
 (0)