isomorfeus-transport 2.0.6 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/transport/rack_middleware.rb +1 -0
- data/lib/isomorfeus/transport/version.rb +1 -1
- data/lib/isomorfeus/transport/websocket_client.rb +6 -2
- data/lib/isomorfeus/transport.rb +3 -2
- data/node_modules/.package-lock.json +27 -27
- data/node_modules/ws/LICENSE +19 -19
- data/node_modules/ws/README.md +489 -496
- data/node_modules/ws/browser.js +8 -8
- data/node_modules/ws/index.js +13 -13
- data/node_modules/ws/lib/buffer-util.js +126 -126
- data/node_modules/ws/lib/constants.js +12 -12
- data/node_modules/ws/lib/event-target.js +266 -266
- data/node_modules/ws/lib/extension.js +203 -203
- data/node_modules/ws/lib/limiter.js +55 -55
- data/node_modules/ws/lib/permessage-deflate.js +511 -511
- data/node_modules/ws/lib/receiver.js +618 -612
- data/node_modules/ws/lib/sender.js +478 -414
- data/node_modules/ws/lib/stream.js +159 -180
- data/node_modules/ws/lib/subprotocol.js +62 -62
- data/node_modules/ws/lib/validation.js +124 -124
- data/node_modules/ws/lib/websocket-server.js +485 -485
- data/node_modules/ws/lib/websocket.js +1225 -1144
- data/node_modules/ws/package.json +61 -61
- data/node_modules/ws/wrapper.mjs +8 -8
- data/package.json +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c29793870992bcb4911f64a8566a4eb6ad8741e159c6d6b46829048d8402be75
|
4
|
+
data.tar.gz: a1ce9f82f0539be983d046b11c5c6f6f5bc611861599ca457803a3f29f36ce22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a83d32f80b58c8a10c965e81693a475b8e48ba1c3799e4525714f2a579fae518d512765f6a95015c32e9919dfff2e8a63dd7f0fbce34e0ad77f1192cfd71f42
|
7
|
+
data.tar.gz: 81dea7ee8204d0cdb521c8b542172fa222a91c97877374975514720ab2e09e9052f006d2cdc41a64b4dfd661a5d2b5c5e61bea27eb1b1bae0515f85ea230559c
|
@@ -16,6 +16,7 @@ module Isomorfeus
|
|
16
16
|
cookie = cookies.detect { |c| c.start_with?('session=') }
|
17
17
|
if cookie
|
18
18
|
session_id = cookie[8..-1]
|
19
|
+
return [Anonymous.new, nil] if session_id.nil? || session_id.empty?
|
19
20
|
user = Isomorfeus.session_store.get_user(session_id: session_id)
|
20
21
|
[user, session_id]
|
21
22
|
end
|
@@ -11,10 +11,14 @@ module Isomorfeus
|
|
11
11
|
|
12
12
|
class SendError < StandardError; end
|
13
13
|
|
14
|
-
def initialize(url, protocols = nil)
|
14
|
+
def initialize(url, protocols = nil, headers = nil)
|
15
15
|
@url = url
|
16
|
-
@native_websocket = if protocols
|
16
|
+
@native_websocket = if protocols && headers
|
17
|
+
`new Opal.global.WebSocket(url, protocols, {headers: #{headers.to_n}})`
|
18
|
+
elsif protocols
|
17
19
|
`new Opal.global.WebSocket(url, protocols)`
|
20
|
+
elsif headers
|
21
|
+
`new Opal.global.WebSocket(url, {headers: #{headers.to_n}})`
|
18
22
|
else
|
19
23
|
`new Opal.global.WebSocket(url)`
|
20
24
|
end
|
data/lib/isomorfeus/transport.rb
CHANGED
@@ -11,7 +11,7 @@ module Isomorfeus
|
|
11
11
|
true
|
12
12
|
end
|
13
13
|
|
14
|
-
def promise_connect
|
14
|
+
def promise_connect(session_id = nil)
|
15
15
|
promise = Promise.new
|
16
16
|
if @socket && @socket.ready_state < 2
|
17
17
|
promise.resolve(true)
|
@@ -24,7 +24,8 @@ module Isomorfeus
|
|
24
24
|
else
|
25
25
|
ws_url = "#{Isomorfeus::TopLevel.transport_ws_url}"
|
26
26
|
end
|
27
|
-
|
27
|
+
headers = (session_id.nil? || session_id.empty?) ? nil : { 'Cookie': "session=#{session_id}" }
|
28
|
+
@socket = Isomorfeus::Transport::WebsocketClient.new(ws_url, nil, headers)
|
28
29
|
@socket.on_error do |error|
|
29
30
|
if Isomorfeus.on_browser?
|
30
31
|
`console.warn('Isomorfeus::Transport: Will try again, but so far error connecting:', error)`
|
@@ -1,27 +1,27 @@
|
|
1
|
-
{
|
2
|
-
"name": "isomorfeus-transport",
|
3
|
-
"lockfileVersion": 2,
|
4
|
-
"requires": true,
|
5
|
-
"packages": {
|
6
|
-
"node_modules/ws": {
|
7
|
-
"version": "8.2
|
8
|
-
"resolved": "https://registry.npmjs.org/ws/-/ws-8.2.
|
9
|
-
"integrity": "sha512-
|
10
|
-
"engines": {
|
11
|
-
"node": ">=10.0.0"
|
12
|
-
},
|
13
|
-
"peerDependencies": {
|
14
|
-
"bufferutil": "^4.0.1",
|
15
|
-
"utf-8-validate": "^5.0.2"
|
16
|
-
},
|
17
|
-
"peerDependenciesMeta": {
|
18
|
-
"bufferutil": {
|
19
|
-
"optional": true
|
20
|
-
},
|
21
|
-
"utf-8-validate": {
|
22
|
-
"optional": true
|
23
|
-
}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
1
|
+
{
|
2
|
+
"name": "isomorfeus-transport",
|
3
|
+
"lockfileVersion": 2,
|
4
|
+
"requires": true,
|
5
|
+
"packages": {
|
6
|
+
"node_modules/ws": {
|
7
|
+
"version": "8.4.2",
|
8
|
+
"resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
|
9
|
+
"integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
|
10
|
+
"engines": {
|
11
|
+
"node": ">=10.0.0"
|
12
|
+
},
|
13
|
+
"peerDependencies": {
|
14
|
+
"bufferutil": "^4.0.1",
|
15
|
+
"utf-8-validate": "^5.0.2"
|
16
|
+
},
|
17
|
+
"peerDependenciesMeta": {
|
18
|
+
"bufferutil": {
|
19
|
+
"optional": true
|
20
|
+
},
|
21
|
+
"utf-8-validate": {
|
22
|
+
"optional": true
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
data/node_modules/ws/LICENSE
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
SOFTWARE.
|
1
|
+
Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|