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



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

StreamEvent = Struct.new(:type, :data, :id, :last_event_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



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

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

#last_event_idString

Returns the id: value that was most recently seen in an event from this stream; this differs from the id property in that it retains the same value in subsequent events if they do not provide their own id:.

Returns:

  • (String)

    the id: value that was most recently seen in an event from this stream; this differs from the id property in that it retains the same value in subsequent events if they do not provide their own id:



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

StreamEvent = Struct.new(:type, :data, :id, :last_event_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



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

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