class Farcall::BossTransport
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
Public Class Methods
new(**params)
click to toggle source
Create json transport, see Farcall::Transport#create for parameters
Calls superclass method
Farcall::Transport::new
# 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
Public Instance Methods
close()
click to toggle source
# 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)
click to toggle source
# File lib/farcall/boss_transport.rb, line 20 def send_data hash @formatter << hash end
Private Instance Methods
load_loop()
click to toggle source
# File lib/farcall/boss_transport.rb, line 35 def load_loop Boss::Parser.new(@input).each { |object| push_input object } rescue Errno::EPIPE close rescue if !@closing STDERR.puts "Farcall::BossTransport read loop failed: #{$!.class.name}: #$!" STDERR.puts $!.backtrace.join("\n") connection_aborted $! else close end end