isomorfeus-transport 1.0.0.zeta22 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +27 -36
- data/lib/isomorfeus/transport/client_processor.rb +35 -30
- data/lib/isomorfeus/transport/config.rb +182 -158
- data/lib/isomorfeus/transport/hamster_session_store.rb +96 -0
- data/lib/isomorfeus/transport/handler/authentication_handler.rb +70 -70
- data/lib/isomorfeus/transport/imports.rb +9 -0
- data/lib/isomorfeus/transport/middlewares.rb +13 -13
- data/lib/isomorfeus/transport/rack_middleware.rb +59 -55
- data/lib/isomorfeus/transport/request_agent.rb +34 -34
- data/lib/isomorfeus/transport/response_agent.rb +23 -23
- data/lib/isomorfeus/transport/server_processor.rb +129 -101
- data/lib/isomorfeus/transport/server_socket_processor.rb +54 -54
- data/lib/isomorfeus/transport/ssr_login.rb +28 -28
- data/lib/isomorfeus/transport/version.rb +5 -5
- data/lib/isomorfeus/transport/{websocket.rb → websocket_client.rb} +123 -123
- data/lib/isomorfeus/transport.rb +200 -213
- data/lib/isomorfeus-transport.rb +70 -64
- data/lib/lucid_authentication/mixin.rb +122 -124
- data/lib/lucid_channel/base.rb +8 -11
- data/lib/lucid_channel/mixin.rb +105 -50
- data/lib/lucid_handler/base.rb +8 -9
- data/lib/lucid_handler/mixin.rb +27 -27
- data/node_modules/.package-lock.json +27 -0
- data/node_modules/ws/LICENSE +19 -0
- data/node_modules/ws/README.md +496 -0
- data/node_modules/ws/browser.js +8 -0
- data/node_modules/ws/index.js +13 -0
- data/node_modules/ws/lib/buffer-util.js +126 -0
- data/node_modules/ws/lib/constants.js +12 -0
- data/node_modules/ws/lib/event-target.js +266 -0
- data/node_modules/ws/lib/extension.js +203 -0
- data/node_modules/ws/lib/limiter.js +55 -0
- data/node_modules/ws/lib/permessage-deflate.js +511 -0
- data/node_modules/ws/lib/receiver.js +612 -0
- data/node_modules/ws/lib/sender.js +414 -0
- data/node_modules/ws/lib/stream.js +180 -0
- data/node_modules/ws/lib/subprotocol.js +62 -0
- data/node_modules/ws/lib/validation.js +124 -0
- data/node_modules/ws/lib/websocket-server.js +485 -0
- data/node_modules/ws/lib/websocket.js +1144 -0
- data/node_modules/ws/package.json +61 -0
- data/node_modules/ws/wrapper.mjs +8 -0
- data/package.json +6 -0
- metadata +82 -46
- data/lib/isomorfeus/transport/dbm_session_store.rb +0 -51
data/lib/isomorfeus/transport.rb
CHANGED
@@ -1,213 +1,200 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
module Transport
|
3
|
-
class << self
|
4
|
-
if RUBY_ENGINE == 'opal'
|
5
|
-
attr_accessor :socket
|
6
|
-
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
Isomorfeus
|
37
|
-
end
|
38
|
-
end
|
39
|
-
@socket.on_message do |event|
|
40
|
-
json_hash = `Opal.Hash.$new(JSON.parse(event.data))`
|
41
|
-
Isomorfeus::Transport::ClientProcessor.process(json_hash)
|
42
|
-
end
|
43
|
-
@socket.on_open do |event|
|
44
|
-
if @initialized
|
45
|
-
requests_in_progress[:requests].each_key do |request|
|
46
|
-
agent = get_agent_for_request_in_progress(request)
|
47
|
-
promise_send_request(request) if agent && !agent.sent
|
48
|
-
end
|
49
|
-
promise.resolve(true)
|
50
|
-
else
|
51
|
-
@initialized = true
|
52
|
-
init_promises = []
|
53
|
-
Isomorfeus.transport_init_class_names.each do |constant|
|
54
|
-
result = constant.constantize.send(:init)
|
55
|
-
init_promises << result if result.class == Promise
|
56
|
-
end
|
57
|
-
if init_promises.size > 0
|
58
|
-
Promise.when(*init_promises).then { promise.resolve(true) }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
promise
|
63
|
-
end
|
64
|
-
|
65
|
-
def disconnect
|
66
|
-
@socket.close if @socket
|
67
|
-
@socket = nil
|
68
|
-
end
|
69
|
-
|
70
|
-
def promise_send_path(*path, &block)
|
71
|
-
request = {}
|
72
|
-
inject_path = path[0...-1]
|
73
|
-
last_inject_path_el = inject_path.last
|
74
|
-
last_path_el = path.last
|
75
|
-
inject_path.inject(request) do |memo, key|
|
76
|
-
if key == last_inject_path_el
|
77
|
-
memo[key] = last_path_el
|
78
|
-
else
|
79
|
-
memo[key] = {}
|
80
|
-
end
|
81
|
-
end
|
82
|
-
Isomorfeus::Transport.promise_send_request(request, &block)
|
83
|
-
end
|
84
|
-
|
85
|
-
def promise_send_request(request, &block)
|
86
|
-
agent = if request_in_progress?(request)
|
87
|
-
get_agent_for_request_in_progress(request)
|
88
|
-
else
|
89
|
-
Isomorfeus::Transport::RequestAgent.new(request)
|
90
|
-
end
|
91
|
-
unless agent.sent
|
92
|
-
if block_given?
|
93
|
-
agent.promise.then do |response|
|
94
|
-
block.call(response)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
register_request_in_progress(request, agent.id)
|
98
|
-
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
99
|
-
begin
|
100
|
-
@socket.send(`JSON.stringify(#{{request: { agent_ids: { agent.id => request }}}.to_n})`)
|
101
|
-
agent.sent = true
|
102
|
-
|
103
|
-
unless agent.promise.realized?
|
104
|
-
agent.promise.reject({agent_response: { error: 'Request timeout!' }, full_response: {}})
|
105
|
-
end
|
106
|
-
end
|
107
|
-
rescue
|
108
|
-
@socket.close
|
109
|
-
|
110
|
-
Isomorfeus::Transport.promise_connect
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
agent.promise
|
115
|
-
end
|
116
|
-
|
117
|
-
def
|
118
|
-
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
119
|
-
@socket.send(`JSON.stringify(#{{notification: { class: channel_class.name, channel: channel, message: message}}.to_n})`)
|
120
|
-
true
|
121
|
-
end
|
122
|
-
|
123
|
-
def
|
124
|
-
request = { subscribe: true, class:
|
125
|
-
if request_in_progress?(request)
|
126
|
-
agent = get_agent_for_request_in_progress(request)
|
127
|
-
else
|
128
|
-
agent = Isomorfeus::Transport::RequestAgent.new(request)
|
129
|
-
register_request_in_progress(request, agent.id)
|
130
|
-
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
131
|
-
@socket.send(`JSON.stringify(#{{subscribe: { agent_ids: { agent.id => request }}}.to_n})`)
|
132
|
-
end
|
133
|
-
result_promise = agent.promise.then do |agent|
|
134
|
-
agent.response
|
135
|
-
end
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
agent
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
end
|
176
|
-
|
177
|
-
def
|
178
|
-
|
179
|
-
|
180
|
-
end
|
181
|
-
|
182
|
-
def
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
result_promise
|
202
|
-
end
|
203
|
-
|
204
|
-
def unsubscribe(channel_class, channel, &block)
|
205
|
-
Thread.current[:isomorfeus_pub_sub_client].unsubscribe(channel)
|
206
|
-
result_promise = Promise.new
|
207
|
-
result_promise.resolve({ success: channel })
|
208
|
-
result_promise
|
209
|
-
end
|
210
|
-
end # RUBY_ENGINE
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
1
|
+
module Isomorfeus
|
2
|
+
module Transport
|
3
|
+
class << self
|
4
|
+
if RUBY_ENGINE == 'opal'
|
5
|
+
attr_accessor :socket
|
6
|
+
|
7
|
+
def init
|
8
|
+
@socket = nil
|
9
|
+
@initialized = false
|
10
|
+
promise_connect if Isomorfeus.on_browser? || Isomorfeus.on_mobile?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def promise_connect
|
15
|
+
promise = Promise.new
|
16
|
+
if @socket && @socket.ready_state < 2
|
17
|
+
promise.resolve(true)
|
18
|
+
return promise
|
19
|
+
end
|
20
|
+
if Isomorfeus.on_browser?
|
21
|
+
window_protocol = `window.location.protocol`
|
22
|
+
ws_protocol = window_protocol == 'https:' ? 'wss:' : 'ws:'
|
23
|
+
ws_url = "#{ws_protocol}//#{`window.location.host`}#{Isomorfeus.api_websocket_path}"
|
24
|
+
else
|
25
|
+
ws_url = "#{Isomorfeus::TopLevel.transport_ws_url}"
|
26
|
+
end
|
27
|
+
@socket = Isomorfeus::Transport::WebsocketClient.new(ws_url)
|
28
|
+
@socket.on_error do |error|
|
29
|
+
if Isomorfeus.on_browser?
|
30
|
+
`console.warn('Isomorfeus::Transport: Will try again, but so far error connecting:', error)`
|
31
|
+
@socket.close
|
32
|
+
after 1000 do
|
33
|
+
Isomorfeus::Transport.promise_connect
|
34
|
+
end
|
35
|
+
else
|
36
|
+
Isomorfeus.raise_error(message: error.JS[:message], stack: error.JS[:stack])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
@socket.on_message do |event|
|
40
|
+
json_hash = `Opal.Hash.$new(JSON.parse(event.data))`
|
41
|
+
Isomorfeus::Transport::ClientProcessor.process(json_hash)
|
42
|
+
end
|
43
|
+
@socket.on_open do |event|
|
44
|
+
if @initialized
|
45
|
+
requests_in_progress[:requests].each_key do |request|
|
46
|
+
agent = get_agent_for_request_in_progress(request)
|
47
|
+
promise_send_request(request) if agent && !agent.sent
|
48
|
+
end
|
49
|
+
promise.resolve(true)
|
50
|
+
else
|
51
|
+
@initialized = true
|
52
|
+
init_promises = []
|
53
|
+
Isomorfeus.transport_init_class_names.each do |constant|
|
54
|
+
result = constant.constantize.send(:init)
|
55
|
+
init_promises << result if result.class == Promise
|
56
|
+
end
|
57
|
+
if init_promises.size > 0
|
58
|
+
Promise.when(*init_promises).then { promise.resolve(true) }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
promise
|
63
|
+
end
|
64
|
+
|
65
|
+
def disconnect
|
66
|
+
@socket.close if @socket
|
67
|
+
@socket = nil
|
68
|
+
end
|
69
|
+
|
70
|
+
def promise_send_path(*path, &block)
|
71
|
+
request = {}
|
72
|
+
inject_path = path[0...-1]
|
73
|
+
last_inject_path_el = inject_path.last
|
74
|
+
last_path_el = path.last
|
75
|
+
inject_path.inject(request) do |memo, key|
|
76
|
+
if key == last_inject_path_el
|
77
|
+
memo[key] = last_path_el
|
78
|
+
else
|
79
|
+
memo[key] = {}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
Isomorfeus::Transport.promise_send_request(request, &block)
|
83
|
+
end
|
84
|
+
|
85
|
+
def promise_send_request(request, &block)
|
86
|
+
agent = if request_in_progress?(request)
|
87
|
+
get_agent_for_request_in_progress(request)
|
88
|
+
else
|
89
|
+
Isomorfeus::Transport::RequestAgent.new(request)
|
90
|
+
end
|
91
|
+
unless agent.sent
|
92
|
+
if block_given?
|
93
|
+
agent.promise.then do |response|
|
94
|
+
block.call(response)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
register_request_in_progress(request, agent.id)
|
98
|
+
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
99
|
+
begin
|
100
|
+
@socket.send(`JSON.stringify(#{{request: { agent_ids: { agent.id => request }}}.to_n})`)
|
101
|
+
agent.sent = true
|
102
|
+
after(Isomorfeus.on_ssr? ? 8000 : 20000) do
|
103
|
+
unless agent.promise.realized?
|
104
|
+
agent.promise.reject({agent_response: { error: 'Request timeout!' }, full_response: {}})
|
105
|
+
end
|
106
|
+
end
|
107
|
+
rescue
|
108
|
+
@socket.close
|
109
|
+
after 5000 do
|
110
|
+
Isomorfeus::Transport.promise_connect
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
agent.promise
|
115
|
+
end
|
116
|
+
|
117
|
+
def send_message(channel_class, channel, message)
|
118
|
+
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
119
|
+
@socket.send(`JSON.stringify(#{{ notification: { class: channel_class.name, channel: channel, message: message }}.to_n})`)
|
120
|
+
true
|
121
|
+
end
|
122
|
+
|
123
|
+
def promise_subscribe(channel_class_name, channel)
|
124
|
+
request = { subscribe: true, class: channel_class_name, channel: channel }
|
125
|
+
if request_in_progress?(request)
|
126
|
+
agent = get_agent_for_request_in_progress(request)
|
127
|
+
else
|
128
|
+
agent = Isomorfeus::Transport::RequestAgent.new(request)
|
129
|
+
register_request_in_progress(request, agent.id)
|
130
|
+
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
131
|
+
@socket.send(`JSON.stringify(#{{ subscribe: { agent_ids: { agent.id => request }}}.to_n})`)
|
132
|
+
end
|
133
|
+
result_promise = agent.promise.then do |agent|
|
134
|
+
agent.response
|
135
|
+
end
|
136
|
+
result_promise
|
137
|
+
end
|
138
|
+
|
139
|
+
def promise_unsubscribe(channel_class_name, channel)
|
140
|
+
request = { unsubscribe: true, class: channel_class_name, channel: channel }
|
141
|
+
if request_in_progress?(request)
|
142
|
+
agent = get_agent_for_request_in_progress(request)
|
143
|
+
else
|
144
|
+
agent = Isomorfeus::Transport::RequestAgent.new(request)
|
145
|
+
register_request_in_progress(request, agent.id)
|
146
|
+
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
147
|
+
@socket.send(`JSON.stringify(#{{ unsubscribe: { agent_ids: { agent.id => request }}}.to_n})`)
|
148
|
+
end
|
149
|
+
result_promise = agent.promise.then do |agent|
|
150
|
+
agent.response
|
151
|
+
end
|
152
|
+
result_promise
|
153
|
+
end
|
154
|
+
|
155
|
+
def busy?
|
156
|
+
requests_in_progress[:requests].size != 0
|
157
|
+
end
|
158
|
+
|
159
|
+
def requests_in_progress
|
160
|
+
@requests_in_progress ||= { requests: {}, agent_ids: {} }
|
161
|
+
end
|
162
|
+
|
163
|
+
def request_in_progress?(request)
|
164
|
+
requests_in_progress[:requests].key?(request)
|
165
|
+
end
|
166
|
+
|
167
|
+
def get_agent_for_request_in_progress(request)
|
168
|
+
agent_id = requests_in_progress[:requests][request]
|
169
|
+
Isomorfeus::Transport::RequestAgent.get(agent_id)
|
170
|
+
end
|
171
|
+
|
172
|
+
def register_request_in_progress(request, agent_id)
|
173
|
+
requests_in_progress[:requests][request] = agent_id
|
174
|
+
requests_in_progress[:agent_ids][agent_id] = request
|
175
|
+
end
|
176
|
+
|
177
|
+
def unregister_request_in_progress(agent_id)
|
178
|
+
request = requests_in_progress[:agent_ids].delete(agent_id)
|
179
|
+
requests_in_progress[:requests].delete(request)
|
180
|
+
end
|
181
|
+
else # RUBY_ENGINE
|
182
|
+
def send_message(channel_class, channel, message)
|
183
|
+
channel_class_name = channel_class.name
|
184
|
+
Isomorfeus.pub_sub_client.publish("#{channel_class_name}_#{channel}", Oj.dump({notification: { class: channel_class_name, channel: channel, message: message}}, mode: :strict))
|
185
|
+
true
|
186
|
+
end
|
187
|
+
|
188
|
+
def promise_subscribe(channel_class, channel, &block)
|
189
|
+
Isomorfeus.pub_sub_client.subscribe(channel)
|
190
|
+
Promise.new.resolve({ success: channel })
|
191
|
+
end
|
192
|
+
|
193
|
+
def promise_unsubscribe(channel_class, channel, &block)
|
194
|
+
Isomorfeus.pub_sub_client.unsubscribe(channel)
|
195
|
+
Promise.new.resolve({ success: channel })
|
196
|
+
end
|
197
|
+
end # RUBY_ENGINE
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
data/lib/isomorfeus-transport.rb
CHANGED
@@ -1,64 +1,70 @@
|
|
1
|
-
require 'isomorfeus-policy'
|
2
|
-
require 'lucid_authentication/mixin'
|
3
|
-
if RUBY_ENGINE == 'opal'
|
4
|
-
require 'json'
|
5
|
-
require 'isomorfeus/
|
6
|
-
require 'isomorfeus/
|
7
|
-
require 'isomorfeus/transport/
|
8
|
-
require 'isomorfeus/transport/
|
9
|
-
require 'isomorfeus/transport/
|
10
|
-
require 'isomorfeus/transport
|
11
|
-
require 'isomorfeus/transport/
|
12
|
-
require '
|
13
|
-
require '
|
14
|
-
|
15
|
-
|
16
|
-
Isomorfeus.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
require '
|
21
|
-
require '
|
22
|
-
require '
|
23
|
-
require 'ostruct'
|
24
|
-
require 'socket'
|
25
|
-
require '
|
26
|
-
require '
|
27
|
-
require 'active_support'
|
28
|
-
require '
|
29
|
-
require '
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
require
|
35
|
-
require 'isomorfeus/transport/
|
36
|
-
require 'isomorfeus/transport/
|
37
|
-
require 'isomorfeus/transport/
|
38
|
-
require 'isomorfeus/transport/
|
39
|
-
require 'isomorfeus/transport/
|
40
|
-
require 'isomorfeus/transport/
|
41
|
-
require 'isomorfeus/transport
|
42
|
-
require 'isomorfeus/transport/
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
require 'lucid_handler/
|
50
|
-
require '
|
51
|
-
require 'lucid_channel/
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
Opal.append_path(__dir__.untaint) unless
|
57
|
-
|
58
|
-
%w[channels handlers server].each do |dir|
|
59
|
-
path = File.expand_path(File.join('app', dir))
|
60
|
-
if Dir.exist?(path)
|
61
|
-
Isomorfeus.zeitwerk.push_dir(path)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
1
|
+
require 'isomorfeus-policy'
|
2
|
+
require 'lucid_authentication/mixin'
|
3
|
+
if RUBY_ENGINE == 'opal'
|
4
|
+
require 'json'
|
5
|
+
require 'isomorfeus/transport/version'
|
6
|
+
require 'isomorfeus/transport/config'
|
7
|
+
require 'isomorfeus/transport/request_agent'
|
8
|
+
require 'isomorfeus/transport/client_processor'
|
9
|
+
require 'isomorfeus/transport/websocket_client'
|
10
|
+
require 'isomorfeus/transport'
|
11
|
+
require 'isomorfeus/transport/ssr_login'
|
12
|
+
require 'lucid_channel/mixin'
|
13
|
+
require 'lucid_channel/base'
|
14
|
+
Isomorfeus.zeitwerk.push_dir('channels')
|
15
|
+
Isomorfeus.add_client_init_class_name('Isomorfeus::Transport')
|
16
|
+
Isomorfeus.add_transport_init_class_name('Isomorfeus::Transport::SsrLogin') if Isomorfeus.on_ssr?
|
17
|
+
else
|
18
|
+
require 'base64'
|
19
|
+
require 'digest'
|
20
|
+
require 'bcrypt'
|
21
|
+
require 'securerandom'
|
22
|
+
require 'fileutils'
|
23
|
+
require 'ostruct'
|
24
|
+
require 'socket'
|
25
|
+
require 'sorted_set'
|
26
|
+
require 'oj'
|
27
|
+
require 'active_support'
|
28
|
+
require 'isomorfeus-asset-manager'
|
29
|
+
require 'isomorfeus/transport/hamster_session_store'
|
30
|
+
opal_path = Gem::Specification.find_by_name('opal').full_gem_path
|
31
|
+
promise_path = File.join(opal_path, 'stdlib', 'promise.rb')
|
32
|
+
require promise_path
|
33
|
+
require 'isomorfeus/transport/version'
|
34
|
+
require 'isomorfeus/transport/response_agent'
|
35
|
+
require 'isomorfeus/transport/config'
|
36
|
+
require 'isomorfeus/transport/middlewares'
|
37
|
+
require 'isomorfeus/transport/request_agent'
|
38
|
+
require 'isomorfeus/transport/server_processor'
|
39
|
+
require 'isomorfeus/transport/server_socket_processor'
|
40
|
+
require 'isomorfeus/transport/websocket_client'
|
41
|
+
require 'isomorfeus/transport'
|
42
|
+
require 'isomorfeus/transport/rack_middleware'
|
43
|
+
require 'isomorfeus/transport/middlewares'
|
44
|
+
|
45
|
+
Isomorfeus.add_middleware(Isomorfeus::Transport::RackMiddleware)
|
46
|
+
Isomorfeus.add_middleware(Isomorfeus::AssetManager::RackMiddleware)
|
47
|
+
|
48
|
+
require 'lucid_handler/mixin'
|
49
|
+
require 'lucid_handler/base'
|
50
|
+
require 'lucid_channel/mixin'
|
51
|
+
require 'lucid_channel/base'
|
52
|
+
|
53
|
+
require 'isomorfeus/transport/handler/authentication_handler'
|
54
|
+
|
55
|
+
require 'iso_opal'
|
56
|
+
Opal.append_path(__dir__.untaint) unless IsoOpal.paths_include?(__dir__.untaint)
|
57
|
+
|
58
|
+
%w[channels handlers server].each do |dir|
|
59
|
+
path = File.expand_path(File.join('app', dir))
|
60
|
+
if Dir.exist?(path)
|
61
|
+
Isomorfeus.zeitwerk.push_dir(path)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
require 'isomorfeus-speednode'
|
66
|
+
Isomorfeus.node_paths << File.expand_path(File.join(File.dirname(__FILE__), '..', 'node_modules'))
|
67
|
+
|
68
|
+
require 'isomorfeus/transport/imports'
|
69
|
+
Isomorfeus::Transport::Imports.add
|
70
|
+
end
|