Class ServerSentEventComment
java.lang.Object
com.soklet.ServerSentEventComment
Encapsulates a Server-Sent Event comment payload and its comment type.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes of Server-Sent Event comments. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ServerSentEventCommentfromComment(@NonNull String comment) Acquires aServerSentEventCommentinstance with acommentpayload.The comment payload.The comment type.static @NonNull ServerSentEventCommentAcquires a shared heartbeat comment instance.toString()
-
Method Details
-
fromComment
Acquires aServerSentEventCommentinstance with acommentpayload.- Parameters:
comment- the comment payload for the instance- Returns:
- the comment instance
-
heartbeatInstance
Acquires a shared heartbeat comment instance.Heartbeat comments do not carry a payload;
getComment()will be empty.- Returns:
- a shared heartbeat comment instance
-
getComment
The comment payload.Heartbeat comments return
Optional.empty().- Returns:
- the comment payload
-
getCommentType
The comment type.- Returns:
- the comment type
-
toString
-