selfsdk 0.0.219 → 0.0.220
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/messaging.rb +8 -0
- data/lib/source_definition.rb +2 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481bff1c6e87afe4127ac3c04dd8072fb6b13dc90a3dcb89f58b627cc712c8d5
|
4
|
+
data.tar.gz: 0e6ce89d41189116ab95e5d42550f7fe48c37061521eab08a97243a484ebd9f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d1da60803edb536f461ea2e7ce05f32ba6a875161dcb9f0fecb000db628e7bc707b26f76c4106df046d7e2085dbf2117200a099ed77df3c85186aee1a8aa27d
|
7
|
+
data.tar.gz: 3ff4efd4c14b24e02c96a88b9f20c5bee4551c6c10aab06d6bbdf367b8ad51ce59170a8dc6144469dadd8f9048e4815b78e9c3fce909a6638ce78686988a116a
|
data/lib/messaging.rb
CHANGED
@@ -19,6 +19,7 @@ module SelfSDK
|
|
19
19
|
|
20
20
|
def initialize(url, auto_reconnect, authentication_hook, process_message_hook)
|
21
21
|
@url = url
|
22
|
+
@connected = false
|
22
23
|
@reconnection_delay = nil
|
23
24
|
@auto_reconnect = auto_reconnect
|
24
25
|
@authentication_hook = authentication_hook
|
@@ -27,6 +28,8 @@ module SelfSDK
|
|
27
28
|
|
28
29
|
# Creates a websocket connection and sets up its callbacks.
|
29
30
|
def start
|
31
|
+
@connected = true
|
32
|
+
|
30
33
|
SelfSDK.logger.debug "starting listener"
|
31
34
|
@ws = Faye::WebSocket::Client.new(@url)
|
32
35
|
SelfSDK.logger.debug "initialized"
|
@@ -37,10 +40,14 @@ module SelfSDK
|
|
37
40
|
end
|
38
41
|
|
39
42
|
@ws.on :message do |event|
|
43
|
+
return if !@connected
|
44
|
+
|
40
45
|
@process_message_hook.call(event)
|
41
46
|
end
|
42
47
|
|
43
48
|
@ws.on :close do |event|
|
49
|
+
return if !@connected
|
50
|
+
|
44
51
|
SelfSDK.logger.debug "connection closed detected : #{event.code} #{event.reason}"
|
45
52
|
|
46
53
|
if not [ON_DEMAND_CLOSE_CODE, CONNECTION_SUPERCEDED].include? event.code
|
@@ -61,6 +68,7 @@ module SelfSDK
|
|
61
68
|
# Sends a closing message to the websocket client.
|
62
69
|
def close
|
63
70
|
SelfSDK.logger.debug "connection closed by the client"
|
71
|
+
@connected = false
|
64
72
|
@ws.close(ON_DEMAND_CLOSE_CODE, "connection closed by the client")
|
65
73
|
end
|
66
74
|
|
data/lib/source_definition.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selfsdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.220
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Self Group Ltd.
|
@@ -422,16 +422,16 @@ require_paths:
|
|
422
422
|
- lib/services
|
423
423
|
required_ruby_version: !ruby/object:Gem::Requirement
|
424
424
|
requirements:
|
425
|
-
- - "
|
425
|
+
- - "~>"
|
426
426
|
- !ruby/object:Gem::Version
|
427
|
-
version: '
|
427
|
+
version: '3'
|
428
428
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
429
429
|
requirements:
|
430
430
|
- - ">="
|
431
431
|
- !ruby/object:Gem::Version
|
432
432
|
version: '0'
|
433
433
|
requirements: []
|
434
|
-
rubygems_version: 3.
|
434
|
+
rubygems_version: 3.3.7
|
435
435
|
signing_key:
|
436
436
|
specification_version: 4
|
437
437
|
summary: joinself sdk
|