Class: WebSocketRb::Protocol::FramesHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/web_socket_rb/protocol/frames_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(connections, connection, routes, frames_sender, sandbox) ⇒ FramesHandler

Returns a new instance of FramesHandler.



12
13
14
15
16
17
18
19
20
21
# File 'lib/web_socket_rb/protocol/frames_handler.rb', line 12

def initialize(connections, connection, routes, frames_sender, sandbox)
  @connections      = connections
  @conn             = connection
  @routes           = routes
  @frames_sender    = frames_sender
  @sandbox          = sandbox
  @threads          = []
  @pending_pings    = []
  @mutex            = Mutex.new
end

Instance Method Details

#runObject

Run reading and sending frames



24
25
26
27
28
# File 'lib/web_socket_rb/protocol/frames_handler.rb', line 24

def run
  @threads << Thread.new { verify_status }
  @threads << Thread.new { process_incoming_frames }
  @threads.each(&:join)
end