Interface EventSource.Emitter

    • Method Detail

      • event

        void event​(String name,
                   String data)
            throws IOException

        Sends a named event with data to the client.

        When invoked as: event("foo", "bar"), the client will receive the lines:

         event: foo
         data: bar
         
        Parameters:
        name - the event name
        data - the data to be sent
        Throws:
        IOException - if an I/O failure occurred
        See Also:
        data(String)
      • data

        void data​(String data)
           throws IOException

        Sends a default event with data to the client.

        When invoked as: data("baz"), the client will receive the line:

         data: baz
         

        When invoked as: data("foo\r\nbar\rbaz\nbax"), the client will receive the lines:

         data: foo
         data: bar
         data: baz
         data: bax
         
        Parameters:
        data - the data to be sent
        Throws:
        IOException - if an I/O failure occurred
      • comment

        void comment​(String comment)
              throws IOException

        Sends a comment to the client.

        When invoked as: comment("foo"), the client will receive the line:

         : foo
         
        Parameters:
        comment - the comment to send
        Throws:
        IOException - if an I/O failure occurred
      • close

        void close()

        Closes this event source connection.