Class: SSE::StreamEvent

Inherits:
Struct
  • Object
show all
Defined in:
lib/ld-eventsource/events.rb

Overview

Server-Sent Event type used by Client. Use Client#on_event to receive events.

Instance Attribute Summary collapse

Instance Attribute Details

#dataString

Returns the string that appeared after ‘data:` in the stream; if there were multiple `data:` lines, they are concatenated with newlines.

Returns:

  • (String)

    the string that appeared after ‘data:` in the stream; if there were multiple `data:` lines, they are concatenated with newlines



15
# File 'lib/ld-eventsource/events.rb', line 15

StreamEvent = Struct.new(:type, :data, :id)

#idString

Returns the string that appeared after ‘id:` in the stream if any, or nil.

Returns:

  • (String)

    the string that appeared after ‘id:` in the stream if any, or nil



15
# File 'lib/ld-eventsource/events.rb', line 15

StreamEvent = Struct.new(:type, :data, :id)

#typeSymbol

Returns the string that appeared after ‘event:` in the stream; defaults to `:message` if `event:` was not specified, will never be nil.

Returns:

  • (Symbol)

    the string that appeared after ‘event:` in the stream; defaults to `:message` if `event:` was not specified, will never be nil



15
# File 'lib/ld-eventsource/events.rb', line 15

StreamEvent = Struct.new(:type, :data, :id)