Class: SockJS::WebSocketSession

Inherits:
Session show all
Defined in:
lib/sockjs/session.rb

Constant Summary

Constants inherited from MetaState::Machine

MetaState::Machine::NON_MESSAGES

Instance Attribute Summary collapse

Attributes inherited from Session

#closing_frame, #data, #disconnect_delay, #interval, #outbox, #response, #transport

Attributes inherited from MetaState::Machine

#current_state

Instance Method Summary collapse

Methods inherited from Session

#_set_heartbeat_timer, #activated, #after_consumer_attached, #after_consumer_detached, #alive?, #check_content_length, #check_response_alive, #clear_all_timers, #clear_timer, #closed, #disconnect_expired, #heartbeat_triggered, #initialize, #max_permitted_content_length, #on_close, #opened, #parse_json, #process_message, #receive_message, #reset_alive_timer, #reset_close_timer, #reset_disconnect_timer, #reset_heartbeat_timer, #run_user_app, #set_alive_timer, #set_close_timer, #set_disconnect_timer, #set_timer, #suspended

Methods inherited from MetaState::Machine

add_state, build_void_state, #debug_with, default_state, default_state=, #initialize, state, #state=, state_names, states, void_state_module

Constructor Details

This class inherits a constructor from SockJS::Session

Instance Attribute Details

#wsObject

Returns the value of attribute ws.



467
468
469
# File 'lib/sockjs/session.rb', line 467

def ws
  @ws
end

Instance Method Details

#after_app_runObject



481
482
483
484
485
# File 'lib/sockjs/session.rb', line 481

def after_app_run
  return super unless self.closing?

  after_close
end

#after_closeObject



487
488
489
490
491
492
493
494
# File 'lib/sockjs/session.rb', line 487

def after_close
  SockJS.debug "after_close: calling #finish"
  finish

  SockJS.debug "after_close: closing @ws and clearing @transport."
  @ws.close
  @transport = nil
end

#send_data(frame) ⇒ Object



470
471
472
473
474
475
476
477
478
479
# File 'lib/sockjs/session.rb', line 470

def send_data(frame)
  if frame.nil?
    raise TypeError.new("Frame must not be nil!")
  end

  unless frame.empty?
    SockJS.debug "@ws.send(#{frame.inspect})"
    @ws.send(frame)
  end
end

#set_alive_checkerObject



496
497
# File 'lib/sockjs/session.rb', line 496

def set_alive_checker
end