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

#alive?, #check_content_length, #check_response_alive, #clear_all_timers, #clear_timer, #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

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.



356
357
358
# File 'lib/sockjs/session.rb', line 356

def ws
  @ws
end

Instance Method Details

#after_app_runObject



370
371
372
373
374
# File 'lib/sockjs/session.rb', line 370

def after_app_run
  return super unless self.closing?

  after_close
end

#after_closeObject



376
377
378
379
380
381
382
383
# File 'lib/sockjs/session.rb', line 376

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



359
360
361
362
363
364
365
366
367
368
# File 'lib/sockjs/session.rb', line 359

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



385
386
# File 'lib/sockjs/session.rb', line 385

def set_alive_checker
end