isomorfeus-transport 2.0.8 → 2.0.9

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: ab4b1f12d2e4f8f86744d97301bc46bc61eb9ada2bfbdfd0c67a153012ffe8c9
4
- data.tar.gz: d7681201d6ea58d69250d68afd1a3a85bd928ea06657df6f6568ae60e89bf251
3
+ metadata.gz: 623527e39fac566112b7017e4bdd35b99092896adab9da3a26196c6d11595e80
4
+ data.tar.gz: '00906d1188360fb9c5be7a3fa5136431441024542dd6e045083cbd0c364ab577'
5
5
  SHA512:
6
- metadata.gz: b724c1a8f0ff3db0e6dcf60c8fc6b651116b8603edd2d0b806f1f774c017652077abe7c49b63ef4e070b67559b4a0addf057fe4cc1d7eb20b521511d6dee9074
7
- data.tar.gz: ca3daa5c4de3b0c0a721bbe23bf9f5c5e7b1e288a57cf30e87ee119bfa945c08cb246cf9b392402804e998d945028b129adbc148d268784a1cb27a2cc05e5a8a
6
+ metadata.gz: 7006b03f04333351df22525a2d6d15d244e42a5f4bc1f96b4c7ecfb85625fadbf1f25af8d7d30b2c71e34e0e6e61b5de0609521ea71696683bf0d963e6d23c1a
7
+ data.tar.gz: f75297a68b357c5b32da8276550f9436b24b5324d3ed170ad9e15b14f0890cb380fe1902eeb6ff232ee1b8cfe009db52a01318815d9ccf6bdba11f8655fc3c76
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Transport
3
- VERSION = '2.0.8'
3
+ VERSION = '2.0.9'
4
4
  end
5
5
  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
@@ -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
- @socket = Isomorfeus::Transport::WebsocketClient.new(ws_url)
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)`
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: 2.0.8
4
+ version: 2.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-25 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 10.6.13
117
+ version: 10.6.14
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 10.6.13
124
+ version: 10.6.14
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: isomorfeus-policy
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 2.0.8
131
+ version: 2.0.9
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 2.0.8
138
+ version: 2.0.9
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: isomorfeus-redux
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 2.0.8
173
+ version: 2.0.9
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 2.0.8
180
+ version: 2.0.9
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rake
183
183
  requirement: !ruby/object:Gem::Requirement