Class: Microphite::Client::Socket
- Defined in:
- lib/microphite/client/socket.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Socket
constructor
A new instance of Socket.
Methods inherited from Base
#close, #gather, #prefix, #time, #write
Constructor Details
#initialize(options) ⇒ Socket
Returns a new instance of Socket.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/microphite/client/socket.rb', line 10 def initialize() defaults = { port: 2003, # Server port transport: :udp, # Transport: tcp or udp min_delay: 2, # Initial delay for write failures (seconds) max_delay: 60, # Maximum delay for write failures (seconds) } params = defaults.merge() # Read-only state @host = params[:host] @port = params[:port] @transport = params[:transport] @min_delay = params[:min_delay] @max_delay = params[:max_delay] # Worker State @socket = nil super() end |