isomorfeus-transport 23.7.0.rc5 → 23.8.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df4f745d6782b577dbbc2bf51d73c2eb5cbc0c2e90427ba5778897744b389b8f
|
4
|
+
data.tar.gz: 0a29391b3582009a6967dc98ea72665892043c2f14347410fbd961b0d466f85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a51f13d0d7337c28b4acd1a236648d37266c83cb0be7de1c0b4a72b2914693d2d85a3468bac4cff291a068b2338875941d35f36fee9f6e83021c2fd1e87c01b
|
7
|
+
data.tar.gz: c1481306af952877776b4f2c31259f2624496ac69bc43dc0993386257bb98619fa4774d14ffd0849d0f780d629766170783e793f0585a229b1b535ff4479c9f8
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# backtick_javascript: true
|
2
|
+
|
1
3
|
module Isomorfeus
|
2
4
|
module Transport
|
3
5
|
class WebsocketClient
|
@@ -11,14 +13,10 @@ module Isomorfeus
|
|
11
13
|
|
12
14
|
class SendError < ::StandardError; end
|
13
15
|
|
14
|
-
def initialize(url, protocols = nil
|
16
|
+
def initialize(url, protocols = nil)
|
15
17
|
@url = url
|
16
|
-
@native_websocket = if protocols
|
17
|
-
`new Opal.global.WebSocket(url, protocols, {headers: #{headers.to_n}})`
|
18
|
-
elsif protocols
|
18
|
+
@native_websocket = if protocols
|
19
19
|
`new Opal.global.WebSocket(url, protocols)`
|
20
|
-
elsif headers
|
21
|
-
`new Opal.global.WebSocket(url, {headers: #{headers.to_n}})`
|
22
20
|
else
|
23
21
|
`new Opal.global.WebSocket(url)`
|
24
22
|
end
|
data/lib/isomorfeus/transport.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# backtick_javascript: true
|
2
|
+
|
1
3
|
module Isomorfeus
|
2
4
|
module Transport
|
3
5
|
class << self
|
4
6
|
if RUBY_ENGINE == 'opal'
|
5
|
-
PING =
|
7
|
+
PING = { iso_ping: true }.to_json
|
6
8
|
|
7
9
|
attr_accessor :socket
|
8
10
|
|
@@ -25,8 +27,7 @@ module Isomorfeus
|
|
25
27
|
ws_protocol = window_protocol == 'https:' ? 'wss:' : 'ws:'
|
26
28
|
ws_url = "#{ws_protocol}//#{`window.location.host`}#{Isomorfeus.api_websocket_path}"
|
27
29
|
|
28
|
-
|
29
|
-
@socket = Isomorfeus::Transport::WebsocketClient.new(ws_url, nil, headers)
|
30
|
+
@socket = Isomorfeus::Transport::WebsocketClient.new(ws_url, nil)
|
30
31
|
@socket.on_error do |error|
|
31
32
|
`console.warn('Isomorfeus::Transport: Will try again, but so far error connecting:', error)`
|
32
33
|
@socket.close
|
@@ -139,7 +140,7 @@ module Isomorfeus
|
|
139
140
|
|
140
141
|
def send_message(channel_class, channel, message)
|
141
142
|
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
142
|
-
@socket.send(
|
143
|
+
@socket.send({ notification: { class: channel_class.name, channel: channel, message: message }}.to_json)
|
143
144
|
true
|
144
145
|
end
|
145
146
|
|
@@ -151,7 +152,7 @@ module Isomorfeus
|
|
151
152
|
agent = Isomorfeus::Transport::RequestAgent.new(request)
|
152
153
|
register_request_in_progress(request, agent.id)
|
153
154
|
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
154
|
-
@socket.send(
|
155
|
+
@socket.send({ subscribe: { agent_ids: { agent.id => request }}}.to_json)
|
155
156
|
end
|
156
157
|
result_promise = agent.promise.then do |agent|
|
157
158
|
agent.response
|
@@ -167,7 +168,7 @@ module Isomorfeus
|
|
167
168
|
agent = Isomorfeus::Transport::RequestAgent.new(request)
|
168
169
|
register_request_in_progress(request, agent.id)
|
169
170
|
Isomorfeus.raise_error(message: 'No socket!') unless @socket
|
170
|
-
@socket.send(
|
171
|
+
@socket.send({ unsubscribe: { agent_ids: { agent.id => request }}}.to_json)
|
171
172
|
end
|
172
173
|
result_promise = agent.promise.then do |agent|
|
173
174
|
agent.response
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-transport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 23.
|
4
|
+
version: 23.8.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.
|
109
|
+
version: 1.8.0.alpha1
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.
|
116
|
+
version: 1.8.0.alpha1
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: opal-zeitwerk
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +190,14 @@ dependencies:
|
|
190
190
|
requirements:
|
191
191
|
- - '='
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 23.
|
193
|
+
version: 23.8.0.rc1
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - '='
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 23.
|
200
|
+
version: 23.8.0.rc1
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: rake
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|