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

#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_heartbeat_timer, #set_timer, #suspended, #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.



460
461
462
# File 'lib/sockjs/session.rb', line 460

def ws
  @ws
end

Instance Method Details

#after_app_runObject



474
475
476
477
478
# File 'lib/sockjs/session.rb', line 474

def after_app_run
  return super unless self.closing?

  after_close
end

#after_closeObject



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

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



463
464
465
466
467
468
469
470
471
472
# File 'lib/sockjs/session.rb', line 463

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



489
490
# File 'lib/sockjs/session.rb', line 489

def set_alive_checker
end