### Version Line Examples
Source: https://www.socketio4j.org/installation/version-policy.md
Examples of versioning patterns for different release lines.
```text
3.y.z
```
```text
4.0.0 ← Current GA (LTS baseline)
4.y.z ← Future LTS releases (patches and minors)
```
```text
5.0.0-SNAPSHOT
```
--------------------------------
### GET /installation/getting-started.md
Source: https://www.socketio4j.org/installation/getting-started.md
Queries the documentation for specific information by providing a question and an optional goal.
```APIDOC
## GET /installation/getting-started.md
### Description
Perform an HTTP GET request on the current page URL to query the documentation dynamically for information not explicitly present in the page.
### Method
GET
### Endpoint
https://www.socketio4j.org/installation/getting-started.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask, written in natural language.
- **goal** (string) - Optional - Describes the broader end goal to help tailor the response.
```
--------------------------------
### GET /adapters/introduction/store.md
Source: https://www.socketio4j.org/adapters/introduction/store.md
Queries the documentation for information by providing a question and an optional goal.
```APIDOC
## GET /adapters/introduction/store.md
### Description
Perform a query against the documentation to retrieve answers, excerpts, and sources based on a natural language question.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/introduction/store.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
### Response
#### Success Response (200)
- **answer** (string) - The direct answer to the question.
- **excerpts** (array) - Relevant excerpts from the documentation.
- **sources** (array) - References to the documentation sources used.
```
--------------------------------
### Configure and Start SocketIOServer
Source: https://www.socketio4j.org/events/example-putting-it-together.md
Initializes a server instance, registers event listeners for connections and custom events, and starts the server.
```java
SocketIOServer server = new SocketIOServer(config);
// connection
server.addConnectListener(client ->
log.info("Connected: {}", client.getSessionId())
);
// listen for chat
server.addEventListener("chat", ChatPayload.class,
(client, payload, ack) -> {
// broadcast to everyone
server.getBroadcastOperations().sendEvent("chat", payload);
}
);
// join room
server.addEventListener("join", String.class,
(client, roomName, ack) -> {
client.joinRoom(roomName);
}
);
server.start();
```
--------------------------------
### Start the Socket.IO Server
Source: https://www.socketio4j.org/server-api/getting-started/server-instance.md
Provides options for starting the server either synchronously or asynchronously.
```java
server.start()
```
```java
server.startAsync().addListener(future -> {
if (future.isSuccess()) {
System.out.println("Server started on " + config.getPort());
} else {
System.out.println("Error " + future.cause().getLocalizedMessage());
}
});
```
--------------------------------
### GET /server-api/getting-started/server-api.md
Source: https://www.socketio4j.org/server-api/getting-started/server-api.md
Queries the documentation for information by providing a specific question and an optional end goal.
```APIDOC
## GET /server-api/getting-started/server-api.md
### Description
Queries the documentation dynamically to retrieve answers, excerpts, and sources based on a natural language question.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/getting-started/server-api.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
```
--------------------------------
### Initialize Socket.IO Server in Micronaut
Source: https://www.socketio4j.org/server-api/server-examples/micronaut.md
Example of starting a Socket.IO server within a Micronaut application using a startup event listener.
```java
@Singleton
public class MicronautMainApplication {
@Inject
SocketIOServer server;
@EventListener
void onStartup(ServerStartupEvent event) {
// Add event listeners
server.addEventListener("chatevent", ChatMessage.class, (client, data, ackRequest) -> {
server.getBroadcastOperations().sendEvent("chatevent", data);
});
server.start();
log.info("Socket.IO server started on port {}", server.getConfiguration().getPort());
}
}
```
--------------------------------
### GET /adapters/examples.md
Source: https://www.socketio4j.org/adapters/examples
Queries the documentation page for specific information using natural language questions.
```APIDOC
## GET /adapters/examples.md
### Description
Performs a query against the documentation page to retrieve answers, excerpts, and sources based on a natural language question.
### Method
GET
### Endpoint
/adapters/examples.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained natural language question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
### Request Example
GET https://www.socketio4j.org/adapters/examples.md?ask=How do I configure Redis?&goal=Setting up a cluster
### Response
#### Success Response (200)
- **answer** (string) - The direct answer to the question.
- **excerpts** (array) - Relevant excerpts from the documentation.
- **sources** (array) - Sources used to generate the answer.
```
--------------------------------
### Release Flow Example
Source: https://www.socketio4j.org/installation/version-policy.md
The progression of version qualifiers leading to a General Availability release.
```text
4.0.0-SNAPSHOT
4.0.0-M1
4.0.0-RC1
4.0.0 ← GA (LTS)
```
--------------------------------
### GET /adapters/introduction.md
Source: https://www.socketio4j.org/adapters/introduction
Queries the documentation for information related to a specific question and optional end goal.
```APIDOC
## GET /adapters/introduction.md
### Description
Performs a dynamic query against the documentation to retrieve answers, excerpts, and sources based on a natural language question.
### Method
GET
### Endpoint
/adapters/introduction.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the relevance of the response.
```
--------------------------------
### Implement Public Namespace
Source: https://www.socketio4j.org/events/namespace.md
Example of setting up an open chat namespace with connection and message listeners.
```java
Configuration config = new Configuration();
config.setPort(9092);
SocketIOServer server = new SocketIOServer(config);
Namespace chat = server.addNamespace("/chat");
// new client connection
chat.addConnectListener(client -> {
log.info("[/chat] connected -> {}", client.getSessionId());
});
// message event
chat.addEventListener("message", String.class, (client, data, ack) -> {
// broadcast to all clients in /chat
chat.getBroadcastOperations().sendEvent("message", data);
});
server.start();
```
```javascript
const chat = io("http://localhost:9092/chat");
chat.on("connect", () => console.log("connected to /chat"));
chat.emit("message", "hello everyone");
```
--------------------------------
### Complete Socket.IO Server Implementation
Source: https://www.socketio4j.org/server-api/getting-started/server-instance.md
A full example demonstrating server configuration, connection listeners, event handling, and startup.
```java
import com.socketio4j.socketio.Configuration;
import com.socketio4j.socketio.SocketIOServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SocketIoServerMain {
private static final Logger log = LoggerFactory.getLogger(SocketIoServerMain.class);
public static void main(String[] args) throws Exception {
// Create configuration
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
// Create server
SocketIOServer server = new SocketIOServer(config);
server.addConnectListener(client -> {
log.info("[/] connected -> " + client.getSessionId());
});
server.addDisconnectListener(client -> {
log.info("[/] disconnected -> " + client.getSessionId());
});
server.addEventListener("hi", String.class, (client, data, ack) -> {
//listen to "reply" in client
log.info("received data : " + data);
client.sendEvent("reply", "hello");
});
// Start server
server.start();
log.info("Socket.IO server started on port 9092");
// Keep JVM alive
Thread.currentThread().join();
}
}
```
--------------------------------
### GET /server-api/getting-started.md
Source: https://www.socketio4j.org/server-api/getting-started
Queries the documentation dynamically by providing a question and an optional goal to receive a tailored answer with relevant excerpts.
```APIDOC
## GET /server-api/getting-started.md
### Description
Queries the documentation dynamically to retrieve answers, excerpts, and sources based on a specific question and an optional end goal.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/getting-started.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### GET /installation/installation-fr/version-policy.md
Source: https://www.socketio4j.org/installation/installation-fr/version-policy
Queries the documentation for specific information by providing a question and an optional end goal.
```APIDOC
## GET /installation/installation-fr/version-policy.md
### Description
Queries the documentation dynamically to retrieve answers, excerpts, and sources based on a provided question.
### Method
GET
### Endpoint
https://www.socketio4j.org/installation/installation-fr/version-policy.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### GET /adapters/adapters-fr/introduction/store-factory-api.md
Source: https://www.socketio4j.org/adapters/adapters-fr/introduction/store-factory-api
Queries the documentation page for specific information using natural language.
```APIDOC
## GET /adapters/adapters-fr/introduction/store-factory-api.md
### Description
Queries the current documentation page to retrieve answers, excerpts, or context based on a natural language question.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-fr/introduction/store-factory-api.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
### Request Example
GET https://www.socketio4j.org/adapters/adapters-fr/introduction/store-factory-api.md?ask=How do I use the store factory?&goal=Implement a custom adapter
```
--------------------------------
### Implement SocketIO4J Client Examples
Source: https://www.socketio4j.org/server-api/server-examples/core-java.md
Demonstrates how to connect to the SocketIO4J server using Java, Node.js, and HTML clients.
```java
//package com.socketio4j.examples.core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.socketio4j.socketio.Configuration;
import com.socketio4j.socketio.SocketIOServer;
import com.socketio4j.socketio.SocketIOClient;
public final class BasicServer {
private static final Logger log = LoggerFactory.getLogger(BasicServer.class);
public static void main(String[] args) {
Configuration config = new Configuration();
config.setHostname("0.0.0.0");
config.setPort(9092);
config.setAckMode(AckMode.MANUAL);
SocketIOServer server = new SocketIOServer(config);
server.addConnectListener(client -> {
log.info("Connected: " + client.getSessionId());
// Join room via query param: ?room=room1
String room = client.getHandshakeData()
.getSingleUrlParam("room");
if (room != null) {
client.joinRoom(room);
log.info("Joined room: " + room);
}
});
server.addDisconnectListener(client ->
log.info("Disconnected: " + client.getSessionId())
);
server.addEventListener(
"message",
String.class,
(SocketIOClient client, String data, var ack) -> {
log.info("Received: " + data);
// Broadcast to all clients
server.getBroadcastOperations()
.sendEvent("message", data);
ack.sendAckData("ok");
}
);
server.start();
log.info("SocketIO4J server started on :9092");
// Keep JVM alive
Thread.currentThread().join();
}
}
```
```javascript
import { io } from "socket.io-client";
const socket = io("http://localhost:9092", {
query: { room: "room1" }
});
socket.on("connect", () => {
console.log("Connected:", socket.id);
socket.emit("message", "Hello from Node.js");
});
socket.on("message", (data) => {
console.log("Received:", data);
});
```
```html
```
--------------------------------
### Initialize Server Configuration
Source: https://www.socketio4j.org/server-api/getting-started/server-configuration.md
Basic setup for a server configuration instance including hostname, port, context, transports, and store factory.
```java
Configuration config = new Configuration();
config.setHostname("127.0.0.1");
config.setPort(9092);
config.setContext("/socket.io");
config.setTransports(Transport.POLLING, Transport.WEBSOCKET);
config.setStoreFactory(new RedisStoreFactory(redissonClient));
```
--------------------------------
### Query documentation via HTTP GET
Source: https://www.socketio4j.org/adapters/adapters-es
Perform an HTTP GET request to the documentation index to retrieve answers based on a specific question and optional goal.
```http
GET https://www.socketio4j.org/adapters/examples/memory-store-+-redis-pub-sub-event-store.md?ask=&goal=
```
--------------------------------
### Install Spring Boot Starter Dependency
Source: https://www.socketio4j.org/installation/getting-started.md
Add the Spring Boot starter module for automated configuration.
```xml
com.socketio4j
netty-socketio-spring-boot-starter
{$socketio.spring-boot-starter.version}
```
```groovy
dependencies {
implementation "com.socketio4j:netty-socketio-spring-boot-starter:${socketioSpringBootStarterVersion}"
}
```
```kotlin
dependencies {
implementation("com.socketio4j:netty-socketio-spring-boot-starter:$socketioSpringBootStarterVersion")
}
```
--------------------------------
### Query documentation via HTTP GET
Source: https://www.socketio4j.org/adapters/adapters-fr
Perform an HTTP GET request to the documentation index to retrieve answers to specific questions.
```http
GET https://www.socketio4j.org/adapters/event-store/hazelcast-ring-buffer.md?ask=&goal=
```
--------------------------------
### GET /server-api/server-examples.md
Source: https://www.socketio4j.org/server-api/server-examples
Queries the documentation dynamically by providing a specific question and an optional goal to retrieve relevant information and excerpts.
```APIDOC
## GET /server-api/server-examples.md
### Description
Queries the documentation dynamically by providing a specific question and an optional goal to retrieve relevant information and excerpts.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/server-examples.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the answer.
```
--------------------------------
### GET /example-projects/sample-projects.md
Source: https://www.socketio4j.org/example-projects/sample-projects
Performs a dynamic query against the documentation to retrieve answers, excerpts, and sources based on a specific question and optional goal.
```APIDOC
## GET /example-projects/sample-projects.md
### Description
Performs a dynamic query against the documentation to retrieve answers, excerpts, and sources based on a specific question and optional goal.
### Method
GET
### Endpoint
/example-projects/sample-projects.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### Install Spring Dependency
Source: https://www.socketio4j.org/installation/getting-started.md
Add the Spring integration module for socketio4j.
```xml
com.socketio4j
netty-socketio-spring
{$socketio.spring.version}
```
```groovy
dependencies {
implementation "com.socketio4j:netty-socketio-spring:${socketioSpringVersion}"
}
```
```kotlin
dependencies {
implementation("com.socketio4j:netty-socketio-spring:$socketioSpringVersion")
}
```
--------------------------------
### GET /installation/gitbook-space-variables.md
Source: https://www.socketio4j.org/installation/gitbook-space-variables.md
Perform a dynamic query against the documentation page to retrieve answers to specific questions.
```APIDOC
## GET /installation/gitbook-space-variables.md
### Description
Perform an HTTP GET request on the current page URL with the `ask` query parameter to retrieve a direct answer to a question based on the documentation content.
### Method
GET
### Endpoint
https://www.socketio4j.org/installation/gitbook-space-variables.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask the documentation system.
- **goal** (string) - Optional - The broader end goal to help tailor the answer.
### Request Example
GET https://www.socketio4j.org/installation/gitbook-space-variables.md?ask=How+do+I+update+variables%3F&goal=installation
```
--------------------------------
### GET /adapters/adapters-fr/magasin-devenements/redis-stream.md
Source: https://www.socketio4j.org/adapters/adapters-fr/magasin-devenements/redis-stream
Queries the documentation for specific information by providing a question and an optional goal.
```APIDOC
## GET /adapters/adapters-fr/magasin-devenements/redis-stream.md
### Description
Queries the documentation dynamically to retrieve answers, excerpts, and sources based on a provided question.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-fr/magasin-devenements/redis-stream.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
```
--------------------------------
### GET /adapters/store/hazelcast-store.md
Source: https://www.socketio4j.org/adapters/adapters-de
Queries the documentation index for information based on a specific question and optional goal.
```APIDOC
## GET /adapters/store/hazelcast-store.md
### Description
Perform an HTTP GET request on the documentation index to retrieve answers to specific questions.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/store/hazelcast-store.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask.
- **goal** (string) - Optional - Describes the broader end goal to tailor the answer.
```
--------------------------------
### GET /adapters/adapters-es/introduccion/store-factory-api.md
Source: https://www.socketio4j.org/adapters/adapters-es/introduccion/store-factory-api
Queries the documentation page dynamically to retrieve answers, excerpts, or context based on a specific question and optional goal.
```APIDOC
## GET /adapters/adapters-es/introduccion/store-factory-api.md
### Description
Queries the documentation page dynamically to retrieve answers, excerpts, or context based on a specific question and optional goal.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-es/introduccion/store-factory-api.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### GET /adapters/adapters-es/almacen-de-eventos/redis-reliable-pub-sub.md
Source: https://www.socketio4j.org/adapters/adapters-es/almacen-de-eventos/redis-reliable-pub-sub
Queries the documentation for specific information by providing a question and an optional goal.
```APIDOC
## GET /adapters/adapters-es/almacen-de-eventos/redis-reliable-pub-sub.md
### Description
Queries the documentation dynamically to retrieve answers, excerpts, and sources based on a specific question.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-es/almacen-de-eventos/redis-reliable-pub-sub.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### GET /adapters/adapters-fr/magasin-devenements/redis-reliable-pub-sub.md
Source: https://www.socketio4j.org/adapters/adapters-fr/magasin-devenements/redis-reliable-pub-sub
Queries the documentation for specific information by providing a question and an optional goal.
```APIDOC
## GET /adapters/adapters-fr/magasin-devenements/redis-reliable-pub-sub.md
### Description
Queries the documentation dynamically to retrieve answers, excerpts, or context related to the documentation content.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-fr/magasin-devenements/redis-reliable-pub-sub.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### Install Java Core Dependency
Source: https://www.socketio4j.org/installation/getting-started.md
Add the core netty-socketio library to your project build configuration.
```xml
com.socketio4j
netty-socketio-core
{$socketio.core.version}
```
```groovy
dependencies {
implementation "com.socketio4j:netty-socketio-core:${socketioCoreVersion}"
}
```
```kotlin
dependencies {
implementation("com.socketio4j:netty-socketio-quarkus:$socketioCoreVersion")
}
```
--------------------------------
### GET /changelog/docs/example.md
Source: https://www.socketio4j.org/changelog/changelog-ja
Performs a query against the documentation index to receive a direct answer and relevant excerpts based on a specific question and optional goal.
```APIDOC
## GET /changelog/docs/example.md
### Description
Perform an HTTP GET request on the documentation index to retrieve answers to specific questions along with relevant documentation excerpts.
### Method
GET
### Endpoint
https://www.socketio4j.org/changelog/docs/example.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question written in natural language.
- **goal** (string) - Optional - Describes the broader end goal to help tailor the response.
### Request Example
GET https://www.socketio4j.org/changelog/docs/example.md?ask=How+do+I+connect%3F&goal=setup
```
--------------------------------
### Querying documentation via HTTP GET
Source: https://www.socketio4j.org/adapters/adapters-es/introduccion/store-factory-api
Use this request format to query the documentation dynamically with specific questions and goals.
```http
GET https://www.socketio4j.org/adapters/adapters-es/introduccion/store-factory-api.md?ask=&goal=
```
--------------------------------
### Querying documentation via HTTP GET
Source: https://www.socketio4j.org/adapters/adapters-es/almacen-de-eventos/redis-stream
Use this request format to query the documentation dynamically with a specific question and optional goal.
```http
GET https://www.socketio4j.org/adapters/adapters-es/almacen-de-eventos/redis-stream.md?ask=&goal=
```
--------------------------------
### GET /server-api/server-api-4.0-es/comenzando/api-del-servidor.md
Source: https://www.socketio4j.org/server-api/server-api-4.0-es/comenzando/api-del-servidor
Realiza una consulta dinámica a la documentación enviando una pregunta y un objetivo opcional como parámetros de consulta.
```APIDOC
## GET /server-api/server-api-4.0-es/comenzando/api-del-servidor.md
### Description
Consulta la documentación de forma dinámica para obtener respuestas, extractos o fuentes relacionadas con una pregunta específica.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/server-api-4.0-es/comenzando/api-del-servidor.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - La pregunta específica, autocontenida y en lenguaje natural.
- **goal** (string) - Optional - El objetivo final que describe el propósito general para adaptar la respuesta.
```
--------------------------------
### GET /server-api/server-api-4.0-de/serverbeispiele/spring-boot.md
Source: https://www.socketio4j.org/server-api/server-api-4.0-de/serverbeispiele/spring-boot
Performs a query against the documentation to retrieve answers and relevant excerpts based on a specific question.
```APIDOC
## GET /server-api/server-api-4.0-de/serverbeispiele/spring-boot.md
### Description
Queries the documentation for information using a natural language question. The response includes a direct answer and relevant source excerpts.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/server-api-4.0-de/serverbeispiele/spring-boot.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask the documentation.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
```
--------------------------------
### Initialize MemoryStoreFactory
Source: https://www.socketio4j.org/adapters/introduction/store-factory-api.md
Creates a factory for single-node setups using in-memory storage and the default MemoryEventStore.
```java
StoreFactory sf = new MemoryStoreFactory();
// in-memory storage + local only events
```
--------------------------------
### Perform an HTTP GET request for documentation
Source: https://www.socketio4j.org/adapters/adapters-es/introduccion/store-factory
Use this URL structure to query the documentation dynamically with specific questions and goals.
```http
GET https://www.socketio4j.org/adapters/adapters-es/introduccion/store-factory.md?ask=&goal=
```
--------------------------------
### Querying Documentation via HTTP GET
Source: https://www.socketio4j.org/socketio4j-vs-others/socketio4j-%2B-netty-%2B-java.md
Use this request format to retrieve specific information or documentation excerpts by providing an ask parameter.
```http
GET https://www.socketio4j.org/socketio4j-vs-others/socketio4j-+-netty-+-java.md?ask=&goal=
```
--------------------------------
### GET /adapters/adapters-es/almacen-de-eventos/redis-stream.md
Source: https://www.socketio4j.org/adapters/adapters-es/almacen-de-eventos/redis-stream
Queries the documentation page dynamically to retrieve answers based on a specific question and optional goal.
```APIDOC
## GET /adapters/adapters-es/almacen-de-eventos/redis-stream.md
### Description
Performs a query against the documentation to retrieve information or context related to the current page.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-es/almacen-de-eventos/redis-stream.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### Query Documentation via HTTP GET
Source: https://www.socketio4j.org/adapters/adapters-de/ereignisspeicher/redis-reliable-pub-sub
Use this request format to retrieve specific information or context from the documentation dynamically.
```http
GET https://www.socketio4j.org/adapters/adapters-de/ereignisspeicher/redis-reliable-pub-sub.md?ask=&goal=
```
--------------------------------
### GET /installation/gitbook-space-variables.md
Source: https://www.socketio4j.org/installation/installation-de
Performs a query against the documentation index to receive a direct answer and relevant source excerpts based on a natural language question.
```APIDOC
## GET /installation/gitbook-space-variables.md
### Description
Performs an HTTP GET request on the documentation index to retrieve an answer to a specific question, along with relevant excerpts and sources.
### Method
GET
### Endpoint
https://www.socketio4j.org/installation/gitbook-space-variables.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask, written in natural language.
- **goal** (string) - Optional - Describes the broader end goal to help tailor the answer.
```
--------------------------------
### GET /
Source: https://www.socketio4j.org/adapters/adapters-de/einfuhrung/store-factory-api
Queries the documentation page dynamically to retrieve answers, excerpts, and sources based on a specific question.
```APIDOC
## GET /
### Description
Queries the current documentation page to retrieve information, excerpts, and sources based on a natural language question.
### Method
GET
### Endpoint
/[page_path]?ask=&goal=
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
### Response
- **answer** (string) - A direct answer to the question.
- **excerpts** (array) - Relevant excerpts from the documentation.
- **sources** (array) - Sources used to generate the answer.
```
--------------------------------
### GET /adapters/event-store.md
Source: https://www.socketio4j.org/adapters/event-store
Performs a query against the documentation to retrieve answers, excerpts, and sources based on a specific question and optional goal.
```APIDOC
## GET /adapters/event-store.md
### Description
Queries the documentation dynamically to retrieve information not explicitly present in the current page.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/event-store.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the answer.
```
--------------------------------
### Initialize Emergency Broadcast Server in Java
Source: https://www.socketio4j.org/example-projects/sample-projects/emergency-broadcast-app.md
Configures and starts a SocketIOServer to listen for 'emergency' events and broadcast them to all connected clients.
```java
import com.socketio4j.socketio.Configuration;
import com.socketio4j.socketio.SocketIOServer;
import com.socketio4j.socketio.SocketIOClient;
public class EmergencyServer {
public static void main(String[] args) {
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
SocketIOServer server = new SocketIOServer(config);
// Event: broadcast emergency messages
server.addEventListener("emergency", String.class,
(SocketIOClient client, String message, var ack) -> {
// print locally
log.info("EMERGENCY message received: {}", message);
// send to all clients
server.getBroadcastOperations().sendEvent("emergency", message);
});
server.start();
log.info("Emergency server started on :9092");
}
}
```
--------------------------------
### GET /events/emitting-events.md
Source: https://www.socketio4j.org/events/emitting-events.md
Query the documentation dynamically using an HTTP GET request.
```APIDOC
## GET /events/emitting-events.md
### Description
Queries the documentation for additional information or clarification.
### Method
GET
### Endpoint
https://www.socketio4j.org/events/emitting-events.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific question to ask.
- **goal** (string) - Optional - The broader end goal for the query.
```
--------------------------------
### Manage Server Start Listeners
Source: https://www.socketio4j.org/server-api/getting-started/server-api.md
Register or remove listeners for server start events. Listeners are executed with exception isolation.
```java
ServerStartListener startListener = s -> {
System.out.println(
"Server started on " + s.getConfiguration().getPort()
);
};
server.addStartListener(startListener);
```
```java
server.removeStartListener(startListener);
```
--------------------------------
### Initialize a Core Java Socket.IO Server
Source: https://www.socketio4j.org/
Demonstrates setting up a basic Socket.IO server with connection, disconnection, and event listeners. Requires the com.socketio4j dependency.
```java
//package com.socketio4j.examples.core;
import com.socketio4j.socketio.Configuration;
import com.socketio4j.socketio.SocketIOServer;
import com.socketio4j.socketio.SocketIOClient;
public final class BasicServer {
public static void main(String[] args) {
Configuration config = new Configuration();
config.setHostname("0.0.0.0");
config.setPort(9092);
SocketIOServer server = new SocketIOServer(config);
server.addConnectListener(client -> {
System.out.println("Connected: " + client.getSessionId());
// Join room via query param: ?room=room1, verify room membership if needed
String room = client.getHandshakeData()
.getSingleUrlParam("room");
if (room != null) {
client.joinRoom(room);
System.out.println("Joined room: " + room);
}
});
server.addDisconnectListener(client ->
System.out.println("Disconnected: " + client.getSessionId())
);
server.addEventListener(
"message",
String.class,
(SocketIOClient client, String data, var ack) -> {
System.out.println("Received: " + data);
// Broadcast to all clients
server.getBroadcastOperations()
.sendEvent("message", data);
ack.sendAckData("ok");
}
);
server.start();
System.out.println("SocketIO4J server started on :9092");
Runtime.getRuntime().addShutdownHook(
new Thread(server::stop)
);
}
}
```
--------------------------------
### Install Micronaut Dependency
Source: https://www.socketio4j.org/installation/getting-started.md
Add the Micronaut integration module for socketio4j.
```xml
com.socketio4j
netty-socketio-micronaut
{$socketio.micronaut.version}
```
```groovy
dependencies {
implementation "com.socketio4j:netty-socketio-micronaut:${socketioMicronautVersion}"
}
```
```kotlin
dependencies {
implementation("com.socketio4j:netty-socketio-micronaut:$socketioMicronautVersion")
}
```
--------------------------------
### Install Quarkus Dependency
Source: https://www.socketio4j.org/installation/getting-started.md
Add the Quarkus integration module for socketio4j.
```xml
com.socketio4j
netty-socketio-quarkus
{$socketio.quarkus.version}
```
```groovy
dependencies {
implementation "com.socketio4j:netty-socketio-quarkus:${socketioQuarkusVersion}"
}
```
```kotlin
dependencies {
implementation("com.socketio4j:netty-socketio-quarkus:$socketioQuarkusVersion")
}
```
--------------------------------
### GET /events/broadcasting.md
Source: https://www.socketio4j.org/events/broadcasting.md
Query the documentation dynamically by asking a question related to the content.
```APIDOC
## GET /events/broadcasting.md
### Description
Perform a query against the documentation to retrieve answers or context regarding broadcasting events.
### Method
GET
### Endpoint
/events/broadcasting.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
### Response
#### Success Response (200)
- **answer** (string) - The direct answer to the question.
- **excerpts** (array) - Relevant excerpts and sources from the documentation.
```
--------------------------------
### GET /adapters/adapters-de/ereignisspeicher/redis-reliable-pub-sub.md
Source: https://www.socketio4j.org/adapters/adapters-de/ereignisspeicher/redis-reliable-pub-sub
Queries the documentation for specific information using natural language.
```APIDOC
## GET /adapters/adapters-de/ereignisspeicher/redis-reliable-pub-sub.md
### Description
Queries the documentation dynamically by asking a question to retrieve relevant excerpts and answers.
### Method
GET
### Endpoint
https://www.socketio4j.org/adapters/adapters-de/ereignisspeicher/redis-reliable-pub-sub.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the answer.
```
--------------------------------
### GET /server-api/server-api-4.0-zh/fu-wu-qi-shi-li/core-java.md
Source: https://www.socketio4j.org/server-api/server-api-4.0-zh/fu-wu-qi-shi-li/core-java
Queries the documentation for specific information by providing a question and an optional goal.
```APIDOC
## GET /server-api/server-api-4.0-zh/fu-wu-qi-shi-li/core-java.md
### Description
Performs a dynamic query against the documentation to retrieve answers, excerpts, and sources based on a natural language question.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/server-api-4.0-zh/fu-wu-qi-shi-li/core-java.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained natural language question.
- **goal** (string) - Optional - The broader end goal to help tailor the response context.
```
--------------------------------
### Create a Socket.IO Server Instance
Source: https://www.socketio4j.org/server-api/getting-started/server-instance.md
Initializes the server configuration and binds it to a specific hostname and port.
```java
Configuration config = new Configuration();
config.setHostname("localhost");
config.setPort(9092);
SocketIOServer server = new SocketIOServer(config);
```
--------------------------------
### GET /home.md
Source: https://www.socketio4j.org/example-projects
Performs a query against the documentation index to retrieve answers and relevant excerpts.
```APIDOC
## GET /home.md
### Description
Perform an HTTP GET request on the documentation index with the `ask` parameter, and the optional `goal` parameter to retrieve a direct answer and relevant documentation excerpts.
### Method
GET
### Endpoint
https://www.socketio4j.org/home.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### GET /events/listening-to-events.md
Source: https://www.socketio4j.org/events/events-fr
Performs a query against the documentation index to retrieve an answer and relevant excerpts.
```APIDOC
## GET /events/listening-to-events.md
### Description
Perform an HTTP GET request on the documentation index with the `ask` parameter, and the optional `goal` parameter to retrieve a direct answer and relevant excerpts from the documentation.
### Method
GET
### Endpoint
https://www.socketio4j.org/events/listening-to-events.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask, written in natural language.
- **goal** (string) - Optional - Describes the broader end goal to tailor the answer.
```
--------------------------------
### Configure SSL/TLS Settings
Source: https://www.socketio4j.org/server-api/getting-started/server-configuration.md
Sets up keystore and truststore credentials for secure server communication.
```java
SocketSslConfig ssl = new SocketSslConfig();
ssl.setKeyStore("keystore.jks");
ssl.setKeyStorePassword("changeit");
/**
//only uses when mTLS/zero-trust scenarios not usually for wss
ssl.setTrustStore("truststore.jks");
ssl.setTrustStorePassword("changeit");
*/
config.setSocketSslConfig(ssl);
```
--------------------------------
### Connect to Socket.IO in Browser (Vanilla JS)
Source: https://www.socketio4j.org/home/home-de
Loads the client via CDN script tag and initializes the connection.
```html
```
--------------------------------
### GET /server-api/server-api-4.0-ja/sbno/core-java.md
Source: https://www.socketio4j.org/server-api/server-api-4.0-ja/sbno/core-java
Queries the documentation page dynamically to retrieve information or clarification regarding the content.
```APIDOC
## GET /server-api/server-api-4.0-ja/sbno/core-java.md
### Description
Performs a dynamic query against the documentation page to retrieve answers to specific questions.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/server-api-4.0-ja/sbno/core-java.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The specific, self-contained question to ask.
- **goal** (string) - Optional - The broader end goal to help tailor the response.
```
--------------------------------
### Query Documentation via HTTP GET
Source: https://www.socketio4j.org/adapters/adapters-de/einfuhrung/store-factory-api
Use this request format to ask specific questions about the documentation. The 'ask' parameter contains the query, while the optional 'goal' parameter provides context for the request.
```http
GET https://www.socketio4j.org/adapters/adapters-de/einfuhrung/store-factory-api.md?ask=&goal=
```
--------------------------------
### GET /server-api/server-api-4.0-de/erste-schritte/server-api.md
Source: https://www.socketio4j.org/server-api/server-api-4.0-de/erste-schritte/server-api
Queries the documentation page for specific information using natural language questions.
```APIDOC
## GET /server-api/server-api-4.0-de/erste-schritte/server-api.md
### Description
Perform an HTTP GET request on the current page URL to query the documentation dynamically.
### Method
GET
### Endpoint
https://www.socketio4j.org/server-api/server-api-4.0-de/erste-schritte/server-api.md
### Parameters
#### Query Parameters
- **ask** (string) - Required - The immediate question to ask, written in natural language.
- **goal** (string) - Optional - Describes the broader end goal to tailor the answer.
```
--------------------------------
### Initialize RedisStoreFactory
Source: https://www.socketio4j.org/adapters/introduction/store-factory-api.md
Uses Redis for session storage and the default RedissonPubSubEventStore for events.
```java
RedissonClient redis = Redisson.create();
StoreFactory sf = new RedisStoreFactory(redis);
// Redis storage + Redis Pub/Sub events
```
--------------------------------
### Implement Main Application
Source: https://www.socketio4j.org/server-api/server-examples/spring-boot.md
Initialize the server and register event listeners within the main Spring Boot application.
```java
@SpringBootApplication
public class SpringBootMainApplication implements CommandLineRunner {
private static final Logger log = LoggerFactory.getLogger(SpringBootMainApplication.class);
@Autowired
private SocketIOServer server;
public static void main(String[] args) {
SpringApplication.run(SpringBootMainApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
// Add event listeners
server.addEventListener("chatevent", ChatMessage.class, (client, data, ackRequest) -> {
server.getBroadcastOperations().sendEvent("chatevent", data);
});
server.start();
log.info("Socket.IO server started on port {}", server.getConfiguration().getPort());
}
}
```
--------------------------------
### Realizar consulta HTTP a la documentación
Source: https://www.socketio4j.org/server-api/server-api-4.0-es/comenzando/api-del-servidor
Utilice este formato de solicitud GET para consultar la documentación de forma dinámica pasando los parámetros ask y goal.
```http
GET https://www.socketio4j.org/server-api/server-api-4.0-es/comenzando/api-del-servidor.md?ask=&goal=
```
--------------------------------
### Server Lifecycle Listeners
Source: https://www.socketio4j.org/server-api/getting-started/server-api.md
Methods to register and remove start and stop listeners for the server lifecycle.
```APIDOC
## Server Lifecycle Listeners
### Description
Register or remove listeners for server start and stop events. Listeners are executed with exception isolation.
### Methods
- `server.addStartListener(ServerStartListener listener)`
- `server.removeStartListener(ServerStartListener listener)`
- `server.addStopListener(ServerStopListener stopListener)`
- `server.removeStopListener(ServerStopListener stopListener)`
```