Module: Isomorfeus

Defined in:
lib/isomorfeus/transport.rb,
lib/isomorfeus/transport/config.rb,
lib/isomorfeus/transport/imports.rb,
lib/isomorfeus/transport/version.rb,
lib/isomorfeus/transport/ssr_login.rb,
lib/isomorfeus/transport/middlewares.rb,
lib/isomorfeus/transport/request_agent.rb,
lib/isomorfeus/transport/response_agent.rb,
lib/isomorfeus/transport/compressor_rack.rb,
lib/isomorfeus/transport/rack_middleware.rb,
lib/isomorfeus/transport/client_processor.rb,
lib/isomorfeus/transport/server_processor.rb,
lib/isomorfeus/transport/websocket_client.rb,
lib/isomorfeus/transport/server_socket_processor.rb,
lib/isomorfeus/transport/handler/authentication_handler.rb

Defined Under Namespace

Modules: Transport

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_logout_pathObject

Returns the value of attribute api_logout_path.



52
53
54
# File 'lib/isomorfeus/transport/config.rb', line 52

def api_logout_path
  @api_logout_path
end

.api_websocket_hostObject

Returns the value of attribute api_websocket_host.



49
50
51
# File 'lib/isomorfeus/transport/config.rb', line 49

def api_websocket_host
  @api_websocket_host
end

.api_websocket_pathObject

Returns the value of attribute api_websocket_path.



51
52
53
# File 'lib/isomorfeus/transport/config.rb', line 51

def api_websocket_path
  @api_websocket_path
end

.api_websocket_portObject

Returns the value of attribute api_websocket_port.



50
51
52
# File 'lib/isomorfeus/transport/config.rb', line 50

def api_websocket_port
  @api_websocket_port
end

Returns the value of attribute cookie_eater_path.



53
54
55
# File 'lib/isomorfeus/transport/config.rb', line 53

def cookie_eater_path
  @cookie_eater_path
end

Class Method Details

.add_middleware(new_middleware) ⇒ Object



59
60
61
# File 'lib/isomorfeus/transport/config.rb', line 59

def add_middleware(new_middleware)
  Isomorfeus.middlewares.push(new_middleware) unless Isomorfeus.middlewares.include?(new_middleware)
end

.add_transport_init_class_name(init_class_name) ⇒ Object



43
44
45
# File 'lib/isomorfeus/transport/config.rb', line 43

def add_transport_init_class_name(init_class_name)
  transport_init_class_names << init_class_name
end

.add_valid_channel_class(klass) ⇒ Object



18
19
20
# File 'lib/isomorfeus/transport/config.rb', line 18

def add_valid_channel_class(klass)
  valid_channel_class_names << raw_class_name(klass)
end

.add_valid_handler_class(klass) ⇒ Object



97
98
99
# File 'lib/isomorfeus/transport/config.rb', line 97

def add_valid_handler_class(klass)
  valid_handler_class_names << raw_class_name(klass)
end

.cached_channel_class(class_name) ⇒ Object



8
9
10
11
12
# File 'lib/isomorfeus/transport/config.rb', line 8

def cached_channel_class(class_name)
  return "::#{class_name}".constantize if Isomorfeus.development?
  return cached_channel_classes[class_name] if cached_channel_classes.key?(class_name)
  cached_channel_classes[class_name] = "::#{class_name}".constantize
end

.cached_channel_classesObject



4
5
6
# File 'lib/isomorfeus/transport/config.rb', line 4

def cached_channel_classes
  @cached_channel_classes ||= {}
end

.cached_handler_class(class_name) ⇒ Object



105
106
107
108
109
# File 'lib/isomorfeus/transport/config.rb', line 105

def cached_handler_class(class_name)
  return "::#{class_name}".constantize if Isomorfeus.development?
  return cached_handler_classes[class_name] if cached_handler_classes.key?(class_name)
  cached_handler_classes[class_name] = "::#{class_name}".constantize
end

.cached_handler_classesObject



101
102
103
# File 'lib/isomorfeus/transport/config.rb', line 101

def cached_handler_classes
  @cached_handler_classes ||= {}
end

.insert_middleware_after(existing_middleware, new_middleware) ⇒ Object



63
64
65
66
67
68
69
70
71
72
# File 'lib/isomorfeus/transport/config.rb', line 63

def insert_middleware_after(existing_middleware, new_middleware)
  index_of_existing = Isomorfeus.middlewares.index(existing_middleware)
  unless Isomorfeus.middlewares.include?(new_middleware)
    if index_of_existing
      Isomorfeus.middlewares.insert(index_of_existing + 1, new_middleware)
    else
      Isomorfeus.middlewares.push(new_middleware)
    end
  end
end

.insert_middleware_before(existing_middleware, new_middleware) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/isomorfeus/transport/config.rb', line 74

def insert_middleware_before(existing_middleware, new_middleware)
  index_of_existing = Isomorfeus.middlewares.index(existing_middleware)
  unless Isomorfeus.middlewares.include?(new_middleware)
    if index_of_existing
      Isomorfeus.middlewares.insert(index_of_existing, new_middleware)
    else
      Isomorfeus.middlewares.push(new_middleware)
    end
  end
end

.middlewaresObject



85
86
87
# File 'lib/isomorfeus/transport/config.rb', line 85

def middlewares
  @middlewares ||= []
end

.pub_sub_clientObject



111
112
113
# File 'lib/isomorfeus/transport/config.rb', line 111

def pub_sub_client
  Thread.current[:isomorfeus_pub_sub_client]
end

.raw_class_name(klass) ⇒ Object



22
23
24
25
26
# File 'lib/isomorfeus/transport/config.rb', line 22

def raw_class_name(klass)
  class_name = klass.name
  class_name = class_name.split('>::').last if class_name.start_with?('#<')
  class_name
end

.valid_channel_class_name?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
# File 'lib/isomorfeus/transport/config.rb', line 38

def valid_channel_class_name?(class_name)
  cached_channel_class(class_name) # because of autoloader
  valid_channel_class_names.include?(class_name)
end

.valid_channel_class_namesObject



14
15
16
# File 'lib/isomorfeus/transport/config.rb', line 14

def valid_channel_class_names
  @valid_channel_class_names ||= Set.new
end

.valid_handler_class_name?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/isomorfeus/transport/config.rb', line 93

def valid_handler_class_name?(class_name)
  valid_handler_class_names.include?(class_name)
end

.valid_handler_class_namesObject



89
90
91
# File 'lib/isomorfeus/transport/config.rb', line 89

def valid_handler_class_names
  @valid_handler_class_names ||= Set.new
end