Skip to content
Open
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3343424
Handle EIO v2/3/4 binary framing; add integration tests
sanjomo Jul 30, 2026
dc28d25
Add lossless JSON byte[] support and tests
sanjomo Jul 30, 2026
cc5676c
Update build.yml
sanjomo Jul 30, 2026
d80f334
Improve EIO polling, base64, JSON and listeners
sanjomo Jul 30, 2026
729c2ff
Fix Engine.IO v4 polling encoding and tests
sanjomo Jul 30, 2026
3f44e6e
Handle PONG/ERROR parsing and add cross-version tests
sanjomo Jul 31, 2026
2180995
Handle Redisson shutdown; add robustness tests
sanjomo Jul 31, 2026
3f20fbf
Update pom.xml
sanjomo Jul 31, 2026
509f041
Fix polling attachment branching and remove unused import
sanjomo Jul 31, 2026
750cbc8
Fix buffer handling & add license headers
sanjomo Jul 31, 2026
73254cb
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] Jul 31, 2026
c927d35
Fix SSL server restart test flakiness
sanjomo Jul 31, 2026
57d87c0
Handle byte[] JSON and fix
sanjomo Aug 1, 2026
0a18669
Shutdown test stores and improve leak detection
sanjomo Aug 1, 2026
cf9e014
Update EventMessageJsonSupport.java
sanjomo Aug 1, 2026
1d13117
Improve shutdown detection and fix flaky tests
sanjomo Aug 1, 2026
e2df931
Remove EngineIOVersion from Packet; refactor encoder API
sanjomo Aug 2, 2026
367cc81
Refactor packet encoding, add license headers
sanjomo Aug 2, 2026
075b21d
Avoid Objects.requireNonNullElse for attachments
sanjomo Aug 2, 2026
82827f2
Update pom.xml
sanjomo Aug 2, 2026
06e0112
Refactor binary packet handling and tests
sanjomo Aug 3, 2026
1e8d121
Add JS interop tests; refine packet handling & disconnect
sanjomo Aug 3, 2026
3c44f53
Improve exception logging for expected disconnects
sanjomo Aug 3, 2026
dec2617
Normalize error message handling in tests
sanjomo Aug 3, 2026
0d725a6
Ensure namespace cleanup on failed disconnect send
sanjomo Aug 3, 2026
cd37012
Handle null packets and add transport upgrade tests
sanjomo Aug 4, 2026
f56ae8c
Update test-clients-transport.js
sanjomo Aug 4, 2026
737c95d
Add socket.io-client v4/minimist; improve tests
sanjomo Aug 4, 2026
9c33a8e
Improve error logging and add JS batch interop test
sanjomo Aug 4, 2026
50526a1
Refactor PacketEncoder encoding logic
sanjomo Aug 4, 2026
a975dca
Add browser JS interop tests and protocol fixes
sanjomo Aug 5, 2026
f52c076
Enhance JS interop tests with client verification
sanjomo Aug 5, 2026
b967a1d
Update build.yml
sanjomo Aug 5, 2026
f996bfb
Update build.yml
sanjomo Aug 5, 2026
a5769cb
Use dynamic ports in browser interop tests
sanjomo Aug 5, 2026
c88f407
Support Java 11 module-info via multi-release JAR
sanjomo Aug 6, 2026
37c2ed4
Update build.yml
sanjomo Aug 6, 2026
e0377bb
Add global Netty leak detector & expand tests, update CI
sanjomo Aug 6, 2026
7b08103
Improve test parallelism and stability
sanjomo Aug 6, 2026
b3a5e3a
Update build-pr.yml
sanjomo Aug 6, 2026
53aafc7
Update junit-platform.properties
sanjomo Aug 6, 2026
728ffa6
Fix ByteBuf leak and improve test stability
sanjomo Aug 6, 2026
a00a764
Add Kafka/NATS cluster tests; refactor test helpers
sanjomo Aug 6, 2026
237a454
Add Hazelcast distributed tests; refactor test support
sanjomo Aug 6, 2026
60920fc
Update DistributedHazelcastClusterTest.java
sanjomo Aug 6, 2026
80dbe5d
Reduce test parallelism
sanjomo Aug 6, 2026
c5e85d4
Remove debug print statements from tests
sanjomo Aug 6, 2026
cbe40c0
Remove unused import and jmockit coverage property
sanjomo Aug 6, 2026
c54357b
Update BrowserInteropTest.java
sanjomo Aug 6, 2026
6de233e
Update BrowserInteropTest.java
sanjomo Aug 6, 2026
d86b351
Defer polling disconnect; numeric byte[] support
sanjomo Aug 7, 2026
578c5a7
Refine logging and Kafka wakeup handling
sanjomo Aug 7, 2026
83ccc26
Default Engine.IO version to V4 and update tests
sanjomo Aug 7, 2026
5c720a6
Add integration tests for stability and resilience
sanjomo Aug 7, 2026
2005e58
Reorganize tests, add JUnit test suites
sanjomo Aug 7, 2026
91ab739
Improve test stability and CI config
sanjomo Aug 7, 2026
c08af9b
Update DistributedRedissonClusterTest.java
sanjomo Aug 8, 2026
d5374e5
Protocol compliance optimisations & JS interop matrix
sanjomo Aug 8, 2026
b18847a
test improvement & protocol compliance
sanjomo Aug 8, 2026
d249668
Update AuthorizeHandlerTest.java
sanjomo Aug 8, 2026
a7954b7
Add reusable interop tests and interop matrix
sanjomo Aug 8, 2026
3f0e6e2
Refactor tests and improve server start handling
sanjomo Aug 9, 2026
c171dad
Update AbstractDistributedJsClientInteropTest.java
sanjomo Aug 9, 2026
96eac8e
Improve distributed client confirmation tracking
sanjomo Aug 9, 2026
8ab38fb
Delay head removal until transport closes
sanjomo Aug 10, 2026
b0668c6
Update pom.xml
sanjomo Aug 14, 2026
cffd7f4
Update pom.xml
sanjomo Aug 14, 2026
e21c7df
Engine.IO v4 support and poll-timeout refactor
sanjomo Aug 18, 2026
e558037
Fix transport races and v4 CONNECT enforcement
sanjomo Aug 19, 2026
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
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Auto-detect text files and normalize line endings
* text=auto

# Declare explicit line endings for java files
*.java text eol=lf
*.xml text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.md text eol=lf
11 changes: 3 additions & 8 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ jobs:
build:
strategy:
matrix:
include:
- java-version: 17
delay: 0
- java-version: 21
delay: 0
- java-version: 25
delay: 0
os: [ubuntu-latest]
java-version: [17, 21, 25]
uses: ./.github/workflows/build.yml
with:
os: "${{ matrix.os }}"
javaVersion: "${{ matrix.java-version }}"
delay: "${{ matrix.delay }}"
69 changes: 51 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ on:
javaVersion:
required: true
type: string
os:
required: false
type: string
default: "ubuntu-latest"
delay:
required: false
type: string
default: "0"

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ inputs.os }}

env:
# Allow Testcontainers to control Docker
Expand All @@ -26,39 +30,68 @@ jobs:
steps:
# --- Staggered delay ---
- name: Stagger job start
run: sleep ${{ inputs.delay }}
env:
DELAY: ${{ inputs.delay }}
run: sleep "$DELAY"

# --- Checkout ---
- name: Checkout
uses: actions/checkout@v4

# --- Enable Docker (already preinstalled on runners) ---
- name: Start Docker daemon
run: |
sudo systemctl start docker
sudo systemctl status docker --no-pager

# --- Validate Docker works ---
- name: Docker Info
run: docker info
uses: actions/checkout@v7

# --- Java / Maven Setup ---
- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v5
with:
java-version: ${{ inputs.javaVersion }}
distribution: temurin
cache: maven

# --- Node.js 22 Setup with Package Caching ---
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'netty-socketio-core/src/test/resources/js-interop/package-lock.json'

# --- Install JS Client Interop Dependencies ---
- name: Install JS Interop Dependencies
working-directory: netty-socketio-core/src/test/resources/js-interop
run: npm ci

# --- Cache Playwright Browsers ---
- name: Cache Playwright Browsers
id: playwright-cache
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('netty-socketio-core/src/test/resources/js-interop/package-lock.json', 'netty-socketio-core/src/test/resources/js-interop/package.json') }}
restore-keys: |
${{ runner.os }}-playwright-

# --- Install Playwright Browsers & OS Deps (On Cache Miss) ---
- name: Install Playwright Browsers & OS Deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
working-directory: netty-socketio-core/src/test/resources/js-interop
run: npx playwright install --with-deps chromium firefox webkit

# --- Install OS Deps Only (On Cache Hit) ---
- name: Install Playwright OS Dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
working-directory: netty-socketio-core/src/test/resources/js-interop
run: npx playwright install-deps chromium firefox webkit

# --- Testcontainers configuration for CI ---
- name: Disable Testcontainers reuse
run: |
echo "testcontainers.reuse.enable=false" > ~/.testcontainers.properties
cat ~/.testcontainers.properties

# --- Build + Tests ---
- name: Build Project
timeout-minutes: 90
timeout-minutes: 120
run: |
export MAVEN_OPTS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN"
mvn --batch-mode --errors --fail-at-end -DforkCount=1 verify
export MAVEN_OPTS="-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN \
-Dorg.slf4j.simpleLogger.defaultLogLevel=WARN \
-Dcom.socketio4j.socketio.level=WARN \
-Dio.netty.leakDetection.level=PARANOID"
mvn --batch-mode --errors --fail-at-end -DforkCount=1C verify
4 changes: 2 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
**/.vscode
**/.idea
**/*.iml
**/dependency-reduced-pom.xml
**/dependency-reduced-pom.xml
**/node_modules/
4 changes: 3 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@
<module name="NestedIfDepth">
<property name="max" value="3"/>
</module>
<module name="NestedTryDepth"/>
<module name="NestedTryDepth">
<property name="max" value="2"/>
</module>
<module name="NoClone"/>
<module name="NoFinalizer"/>
<module name="OneStatementPerLine"/>
Expand Down
21 changes: 16 additions & 5 deletions netty-socketio-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@
<artifactId>testcontainers-kafka</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
Expand All @@ -177,6 +172,16 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down Expand Up @@ -207,6 +212,12 @@
<artifactId>socket.io-client</artifactId>
<scope>test</scope>
</dependency>
<!-- OkHttp for raw HTTP/WS integration tests (EIOv3, SSL, etc.) -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void sendAckData(List<Object> objs) {
if (!isAckRequested() || !sent.compareAndSet(false, true)) {
return;
}
Packet ackPacket = new Packet(PacketType.MESSAGE, client.getEngineIOVersion());
Packet ackPacket = new Packet(PacketType.MESSAGE);
ackPacket.setSubType(PacketType.ACK);
ackPacket.setAckId(originalPacket.getAckId());
ackPacket.setData(objs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import java.util.Objects;
import java.util.function.Predicate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.socketio4j.socketio.misc.IterableCollection;
import com.socketio4j.socketio.protocol.EngineIOVersion;
import com.socketio4j.socketio.protocol.Packet;
import com.socketio4j.socketio.protocol.PacketType;
import com.socketio4j.socketio.store.StoreFactory;
Expand All @@ -34,6 +36,7 @@
* Date: 2020/8/8 6:08 PM
*/
public class SingleRoomBroadcastOperations implements BroadcastOperations {
private static final Logger log = LoggerFactory.getLogger(SingleRoomBroadcastOperations.class);
private final String namespace;
private final String room;
private final Iterable<SocketIOClient> clients;
Expand Down Expand Up @@ -61,7 +64,6 @@ public Collection<SocketIOClient> getClients() {
@Override
public void send(Packet packet) {
for (SocketIOClient client : clients) {
packet.setEngineIOVersion(client.getEngineIOVersion());
client.send(packet);
}
dispatch(packet);
Expand Down Expand Up @@ -92,13 +94,12 @@ public void sendEvent(String name, SocketIOClient excludedClient, Object... data

@Override
public void sendEvent(String name, Predicate<SocketIOClient> excludePredicate, Object... data) {
Packet packet = new Packet(PacketType.MESSAGE, EngineIOVersion.UNKNOWN);
Packet packet = new Packet(PacketType.MESSAGE);
packet.setSubType(PacketType.EVENT);
packet.setName(name);
packet.setData(Arrays.asList(data));

for (SocketIOClient client : clients) {
packet.setEngineIOVersion(client.getEngineIOVersion());
if (excludePredicate.test(client)) {
continue;
}
Expand All @@ -109,7 +110,7 @@ public void sendEvent(String name, Predicate<SocketIOClient> excludePredicate, O

@Override
public void sendEvent(String name, Object... data) {
Packet packet = new Packet(PacketType.MESSAGE, EngineIOVersion.UNKNOWN);
Packet packet = new Packet(PacketType.MESSAGE);
packet.setSubType(PacketType.EVENT);
packet.setName(name);
packet.setData(Arrays.asList(data));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ public Future<Void> startAsync() {
}

try {
configCopy.setPort(configuration.getPort());
fireBeforeStart();
log.info("Session store / event store factory: {}", configCopy.getStoreFactory());
initGroups();
Expand Down Expand Up @@ -1068,6 +1069,16 @@ public void addConnectListener(ConnectListener listener) {
mainNamespace.addConnectListener(listener);
}

@Override
public void removeConnectListener(ConnectListener listener) {
mainNamespace.removeConnectListener(listener);
}

@Override
public void removeDisconnectListener(DisconnectListener listener) {
mainNamespace.removeDisconnectListener(listener);
}

/**
* Registers a listener that is notified when a ping frame
* is received from a client.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright (c) 2025 The Socketio4j Project
* Parent project : Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.socketio4j.socketio.annotation;

/**
* @author https://github.com/sanjomo
* @date 02/08/26 6:40 pm
*/

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;

/**
* Marks an API as internal to socketio4j.
*
* <p>Types and members annotated with {@code @Internal} are implementation
* details and are <strong>NOT</strong> part of the supported public API.
* They may change, move, or be removed without notice in any release.
*
* <p>Application code should not depend on these APIs.
*/
@Documented
@Retention(CLASS)
@Target({
TYPE,
METHOD,
CONSTRUCTOR,
FIELD,
PACKAGE
})
public @interface Internal {
}
Loading
Loading