public class SseEmitter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Runnable |
onCompletion |
protected Consumer<Throwable> |
onError |
protected org.noear.solon.core.util.ConsumerEx<SseEmitter> |
onInited |
protected Runnable |
onTimeout |
protected long |
timeout |
| Constructor and Description |
|---|
SseEmitter(long timeout)
超时(用于异步超时)
|
| Modifier and Type | Method and Description |
|---|---|
void |
complete()
完成(用于手动控制)
|
protected void |
initialize(SseEmitterHandler handler)
初始化
|
SseEmitter |
onCompletion(Runnable onCompletion)
完成回调方法
|
SseEmitter |
onError(Consumer<Throwable> onError)
异常回调方法
|
SseEmitter |
onInited(org.noear.solon.core.util.ConsumerEx<SseEmitter> onInited)
初始化回调方法
|
SseEmitter |
onTimeout(Runnable onTimeout)
超时回调方法
|
void |
send(SseEvent event)
发送事件
|
void |
send(String data)
发送事件内容
|
protected Runnable onCompletion
protected Runnable onTimeout
protected org.noear.solon.core.util.ConsumerEx<SseEmitter> onInited
protected long timeout
public SseEmitter onCompletion(Runnable onCompletion)
public SseEmitter onTimeout(Runnable onTimeout)
public SseEmitter onError(Consumer<Throwable> onError)
public SseEmitter onInited(org.noear.solon.core.util.ConsumerEx<SseEmitter> onInited)
public void send(String data) throws IOException
data - 事件数据IOExceptionpublic void send(SseEvent event) throws IOException
event - 事件数据IOExceptionpublic void complete()
protected void initialize(SseEmitterHandler handler) throws Throwable
ThrowableCopyright © 2025. All rights reserved.