Class: Farcall::BossTransport
- Includes:
- TransportBase
- Defined in:
- lib/farcall/boss_transport.rb
Overview
Boss transport is more spece-effective than json, supports more data types, and does not need delimiters to separate packets in the stream. Creation parameters are the same as of Farcall::Transport
Instance Attribute Summary
Attributes inherited from Transport
#on_abort, #on_close, #on_data_received
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(**params) ⇒ BossTransport
constructor
Create json transport, see Farcall::Transport#create for parameters.
- #send_data(hash) ⇒ Object
Methods included from TransportBase
#close_connection, #setup_streams
Methods inherited from Transport
#closed?, create, #push_input, #receive_data
Constructor Details
#initialize(**params) ⇒ BossTransport
Create json transport, see Farcall::Transport#create for parameters
10 11 12 13 14 15 16 17 18 |
# File 'lib/farcall/boss_transport.rb', line 10 def initialize **params super() setup_streams **params @formatter = Boss::Formatter.new(@output) @formatter.set_stream_mode @thread = Thread.start { load_loop } end |
Instance Method Details
#close ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/farcall/boss_transport.rb', line 24 def close if !@closing @closing = true close_connection @thread and @thread.join @thread = nil end end |
#send_data(hash) ⇒ Object
20 21 22 |
# File 'lib/farcall/boss_transport.rb', line 20 def send_data hash @formatter << hash end |