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
# 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       = []
end

Instance Method Details

#runObject

Run reading and sending frames



22
23
24
25
26
# File 'lib/web_socket_rb/protocol/frames_handler.rb', line 22

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