Package ratpack.sse

Interface ServerSentEvent

  • All Superinterfaces:
    io.netty.util.ReferenceCounted

    public interface ServerSentEvent
    extends io.netty.util.ReferenceCounted
    A server sent event.

    This object maintains references to several bytebufs. Releasing this object releases each held buffer.

    Since:
    1.10
    • Method Detail

      • builder

        static ServerSentEventBuilder builder()
        Creates a builder for an event.
        Returns:
        a builder for an event
      • getId

        io.netty.buffer.ByteBuf getId()
        The “id” value of the event.
        Returns:
        the “id” value of the event
      • getIdAsString

        default java.lang.String getIdAsString()
        The “id” value of the event.
        Returns:
        the “id” value of the event
      • getEvent

        io.netty.buffer.ByteBuf getEvent()
        The “event” value of the event.
        Returns:
        the “event” value of the event
      • getEventAsString

        default java.lang.String getEventAsString()
        The “event” value of the event.
        Returns:
        the “event” value of the event
      • getData

        java.util.List<io.netty.buffer.ByteBuf> getData()
        The “data” value of the event.

        Each list element corresponds to a line of data.

        Returns:
        the “data” value of the event
      • getDataAsString

        default java.lang.String getDataAsString()
        The “data” value of the event.

        Returns:
        the “data” value of the event
      • getComment

        java.util.List<io.netty.buffer.ByteBuf> getComment()
        The “comment” value of the event.
        Returns:
        the “comment” value of the event
      • getCommentAsString

        default java.lang.String getCommentAsString()
        The “comment” value of the event.

        Each list element corresponds to a line of data.

        Returns:
        the “comment” value of the event
      • retain

        ServerSentEvent retain()
        Specified by:
        retain in interface io.netty.util.ReferenceCounted
      • retain

        ServerSentEvent retain​(int increment)
        Specified by:
        retain in interface io.netty.util.ReferenceCounted
      • touch

        ServerSentEvent touch()
        Specified by:
        touch in interface io.netty.util.ReferenceCounted
      • touch

        ServerSentEvent touch​(java.lang.Object hint)
        Specified by:
        touch in interface io.netty.util.ReferenceCounted
      • join

        static io.netty.buffer.ByteBuf join​(java.util.List<io.netty.buffer.ByteBuf> lines)
        Joins a list of byte buf lines to a single byte buf.

        Can be used with getData() or getComment() to obtain the multi-line value.

        Parameters:
        lines - a list of UTF-8 lines
        Returns:
        a new byte buffer of the lines joined with a newline