Class Sse.Events
java.lang.Object
com.codename1.backend.Sse.Events
- Enclosing class:
Sse
The open stream.
event, id and retry set fields of the NEXT event,
which data(String), json(Object) or send() then writes and flushes.-
Method Summary
Modifier and TypeMethodDescriptionvoidA comment line, which every client ignores.voidSends one event with this data.Names the next event; a client listens for it withaddEventListener(name, ...).The id of the next event, which the client sends back asLast-Event-IDwhen it reconnects.voidSends one event whose data isvalueas JSON, encoded straight into the buffer.TheLast-Event-IDthe client reconnected with, or null on a first connection.voidping()Keeps an idle stream open through proxies; the client sees nothing.retry(long millis) How long the client waits before reconnecting, sent with the next event.voidsend()Sends the pendingevent/id/retryfields with no data.
-
Method Details
-
lastEventId
TheLast-Event-IDthe client reconnected with, or null on a first connection. Resume after it. -
event
Names the next event; a client listens for it withaddEventListener(name, ...). Unnamed events aremessage. -
id
The id of the next event, which the client sends back asLast-Event-IDwhen it reconnects. -
retry
How long the client waits before reconnecting, sent with the next event. -
data
Sends one event with this data. Each line of a multi-line value becomes its owndata:field, which the client joins back with\n.- Throws:
IOException
-
json
Sends one event whose data isvalueas JSON, encoded straight into the buffer. JSON has no raw line breaks, so it is always one line.- Throws:
IOException
-
send
Sends the pendingevent/id/retryfields with no data. A browser dispatches nothing for it, but records the id and the retry.- Throws:
IOException
-
comment
A comment line, which every client ignores.- Throws:
IOException
-
ping
Keeps an idle stream open through proxies; the client sees nothing.- Throws:
IOException
-