> This page is for SDK, version Legacy.
> For other versions, use one of these documentation indexes:
> - Current (default): https://buildwithfern.com/learn/sdks/current/llms.txt
> - Legacy: https://buildwithfern.com/learn/sdks/legacy/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

## 3.14.2

**`(fix):`** 修复请求体中 Optional.empty() 的双重包装问题。线路测试和动态代码片段现在正确生成 Optional.empty() 而不是 Optional.of(Optional.empty()) 用于可选请求体。

## 3.14.1

**`(fix):`** 通过从预期 JSON 中删除联合基础属性来修复线路测试失败。Java 生成器不为联合类型生成基础属性，因此线路测试预期现在排除这些字段以匹配实际 SDK 序列化行为。

## 3.14.0

**`(feat):`** 添加对具有双向通信的 WebSocket 通道的支持。生成的 WebSocket 客户端提供具有指数退避的自动重连、强类型消息处理器和断连期间的消息队列。客户端可通过子包客户端中的工厂方法访问。

```java
// 使用路径和查询参数创建 WebSocket 客户端
RealtimeWebSocketClient ws = client.realtime().realtimeWebSocket(
    "session-123",
    Optional.of("gpt-4"),
    Optional.of(0)
);

// 注册处理器并连接
ws.onReceive(message -> System.out.println("Received: " + message.getAlpha()));
ws.onConnected(() -> System.out.println("Connected!"));
ws.connect().get();

// 发送类型化消息
ws.sendSend(SendEvent.builder()
    .sendText("Hello WebSocket!")
    .sendParam(42)
    .build());
```