Class: Ansible::SSE

Inherits:
Object
  • Object
show all
Defined in:
lib/ansible/sse.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ SSE

Returns a new instance of SSE.



5
6
7
# File 'lib/ansible/sse.rb', line 5

def initialize(stream)
  @stream = stream
end

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



3
4
5
# File 'lib/ansible/sse.rb', line 3

def stream
  @stream
end

Instance Method Details

#closeObject



15
16
17
# File 'lib/ansible/sse.rb', line 15

def close
  stream.close
end

#write(event, message) ⇒ Object



9
10
11
12
13
# File 'lib/ansible/sse.rb', line 9

def write(event, message)
  stream.write "event: #{event}\n"
  stream.write "retry: 1000\n"
  stream.write "data: #{message}\n\n"
end