public class SseEmitter extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected Runnable |
onCompletion |
protected Consumer<Throwable> |
onError |
protected org.noear.solon.core.util.ConsumerEx<SseEmitter> |
onInited |
protected Runnable |
onTimeout |
protected long |
timeout |
| 构造器和说明 |
|---|
SseEmitter(long timeout)
超时(用于异步超时)
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 © 2024. All rights reserved.