Class: OverSIP::WebSocket::Connection

Inherits:
EM::Connection
  • Object
show all
Includes:
Logger, SIP::MessageProcessor
Defined in:
lib/oversip/websocket/listeners/connection.rb

Direct Known Subclasses

WsServer

Constant Summary

Constants included from SIP::MessageProcessor

SIP::MessageProcessor::MSG_TYPE

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logger

close, fg_system_msg2str, init_logger_mq, load_methods, #log_id, syslog_system_msg2str, syslog_user_msg2str

Constructor Details

#initializeConnection

Returns a new instance of Connection.



29
30
31
32
33
# File 'lib/oversip/websocket/listeners/connection.rb', line 29

def initialize
  @buffer = ::IO::Buffer.new
  @state = :init
  @cvars = {}
end

Class Attribute Details

.connectionsObject

Returns the value of attribute connections.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def connections
  @connections
end

.invite_client_transactionsObject

Returns the value of attribute invite_client_transactions.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def invite_client_transactions
  @invite_client_transactions
end

.invite_server_transactionsObject

Returns the value of attribute invite_server_transactions.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def invite_server_transactions
  @invite_server_transactions
end

.ipObject

Returns the value of attribute ip.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def ip
  @ip
end

.ip_typeObject

Returns the value of attribute ip_type.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def ip_type
  @ip_type
end

.non_invite_client_transactionsObject

Returns the value of attribute non_invite_client_transactions.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def non_invite_client_transactions
  @non_invite_client_transactions
end

.non_invite_server_transactionsObject

Returns the value of attribute non_invite_server_transactions.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def non_invite_server_transactions
  @non_invite_server_transactions
end

.outbound_path_fragmentObject

Returns the value of attribute outbound_path_fragment.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def outbound_path_fragment
  @outbound_path_fragment
end

.outbound_record_route_fragmentObject

Returns the value of attribute outbound_record_route_fragment.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def outbound_record_route_fragment
  @outbound_record_route_fragment
end

.portObject

Returns the value of attribute port.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def port
  @port
end

.record_routeObject

Returns the value of attribute record_route.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def record_route
  @record_route
end

.transportObject

Returns the value of attribute transport.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def transport
  @transport
end

.via_coreObject

Returns the value of attribute via_core.



9
10
11
# File 'lib/oversip/websocket/listeners/connection.rb', line 9

def via_core
  @via_core
end

Instance Attribute Details

#cvarsObject (readonly)

Returns the value of attribute cvars.



27
28
29
# File 'lib/oversip/websocket/listeners/connection.rb', line 27

def cvars
  @cvars
end

Class Method Details

.outbound_listener?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/oversip/websocket/listeners/connection.rb', line 21

def outbound_listener?
  @is_outbound_listener
end

.reliable_transport_listener?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/oversip/websocket/listeners/connection.rb', line 17

def reliable_transport_listener?
  @is_reliable_transport_listener
end

Instance Method Details

#close(status = nil, reason = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/oversip/websocket/listeners/connection.rb', line 39

def close status=nil, reason=nil
  # When in WebSocket protocol send a close control frame before closing
  # the connection.
  if @state == :websocket
    @ws_framing.send_close_frame status, reason
  end

  close_connection_after_writing
  @state = :ignore
end

#open?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/oversip/websocket/listeners/connection.rb', line 35

def open?
  ! error?
end