Class: ManagerRemoteWebSockets

Inherits:
ManagerRemoteSocketBase show all
Defined in:
lib/mrpin/core/remote/socket/websocket/manager_remote_web_sockets.rb

Instance Attribute Summary

Attributes inherited from ManagerRemoteSocketBase

#ip, #port, #port_secure, #sessions

Instance Method Summary collapse

Methods inherited from ManagerRemoteSocketBase

#on_client_request_policy, #on_server_maintenance_on, #on_server_shutdown, #post_init

Methods included from ManagerRemoteSocketStatistic

#store_handler_profiler_data

Methods included from ManagerRemoteSocketSessions

#init_sessions, #on_client_connected, #on_client_disconnected

Methods included from ManagerRemoteSocketHandle

#handle_data_from, #requests_pending

Methods included from ManagerRemoteSocketDisconnect

#disconnect_all_with_message, #disconnect_inactive

Methods inherited from ManagerBase

#cleanup_data, #invalidate_cache, #load_init_data, #on_data_loaded, #on_server_maintenance_on, #on_server_shutdown, #on_server_started, #post_init, #start_tasks

Constructor Details

#initializeManagerRemoteWebSockets

Returns a new instance of ManagerRemoteWebSockets.



17
18
19
20
21
22
23
# File 'lib/mrpin/core/remote/socket/websocket/manager_remote_web_sockets.rb', line 17

def initialize
  super

  @class_client = @class_client || SocketClientWebSockets

  @class_client.manager_remote = self
end

Instance Method Details

#start!(callback = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mrpin/core/remote/socket/websocket/manager_remote_web_sockets.rb', line 27

def start!(callback = nil)

  path_private_key = ENV['SERVER_PRIVATE_KEY']
  path_certificate = ENV['SERVER_CERTIFICATE']

  @port = Constants::REMOTE_PORT_WEBSOCKET

  start_server(@port, nil, callback)

  if !path_private_key.nil? && !path_certificate.nil?
    tls_options =
        {
            private_key_file: path_private_key,
            cert_chain_file:  path_certificate,
        }

    @logger.info 'try start secure websocket server'

    @port_secure = Constants::REMOTE_PORT_WEBSOCKET_SECURE

    start_server(@port_secure, tls_options, callback)
  end

  nil
end