|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object play.mvc.Results.Chunks<java.lang.String> play.libs.EventSource
public abstract class EventSource
Nested Class Summary |
---|
Nested classes/interfaces inherited from class play.mvc.Results.Chunks |
---|
Results.Chunks.Out<A> |
Constructor Summary | |
---|---|
EventSource()
Create a new EventSource socket |
Method Summary | |
---|---|
void |
close()
Close the channel |
abstract void |
onConnected()
The socket is ready, you can start sending messages. |
void |
onDisconnected(F.Callback0 callback)
Add a callback to be notified when the client has disconnected. |
void |
onReady(Results.Chunks.Out<java.lang.String> out)
Called when the Chunked stream is ready. |
void |
sendData(java.lang.String data)
Sending a generic event. |
void |
sendDataById(java.lang.String eventId,
java.lang.String data)
Setting an ID lets the browser keep track of the last event fired so that if, the connection to the server is dropped, a special HTTP header (Last-Event-ID) is set with the new request. |
void |
sendDataByName(java.lang.String eventName,
java.lang.String data)
A single event source can generate different types events by including an event name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventSource()
Method Detail |
---|
public void onReady(Results.Chunks.Out<java.lang.String> out)
Results.Chunks
onReady
in class Results.Chunks<java.lang.String>
out
- The out stream.public void sendDataByName(java.lang.String eventName, java.lang.String data)
eventName
- Unique name of the event.data
- data associated with eventpublic void sendDataById(java.lang.String eventId, java.lang.String data)
eventId
- Unique event id.data
- data associated with eventpublic void sendData(java.lang.String data)
data
- data associated with eventpublic abstract void onConnected()
public void onDisconnected(F.Callback0 callback)
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |