sps_chat 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: babe132c0c9ab4ad4fb183a05cc00c56fec0801b
4
- data.tar.gz: 35bd641347de1192b6e4fa5347b70d3a7d36f880
3
+ metadata.gz: a6478683020ca1ea0046516cd4aa64c493205038
4
+ data.tar.gz: 57680e445c4c8b1419041e864dee0d0a4c8aad5e
5
5
  SHA512:
6
- metadata.gz: '06309ace22e03c92cfa3cb10dcb38011ea15acce42e2f1a9135be56b549cf1e7a3cdbf99c2f1a2f2e6f518e9ac8c32a6607fb1bda3762a78f7303102105e4525'
7
- data.tar.gz: a745a9f2e2b1905596748aac527c91579357215518f3c8978e25fd60e7ee94cb94128e6b0593b70bb9ee63e716b67480534b026d4f1181791e205ddb92577aba
6
+ metadata.gz: 7857ec94ddafdfe7248181ef55218bc189239e62c81b38280b47b2dfbd74c2f7fc2c1df0cbaa03207ab4f2a830d2fd7ff1b15d2b9aa1fa9aa4ede32d5caa1bf4
7
+ data.tar.gz: cc1174dba940918ec2150863ebe78dd881ddd0b938b25e4f969ad1ae5330d6ef92dc5055c08ac658fdc85545844e4868d079aa2e6f0508ee5ffd7910f0a72be9
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,36 +2,17 @@
2
2
 
3
3
  # file: sps_chat.rb
4
4
 
5
- require 'sps-pub'
6
- require 'sps-sub'
5
+ require 'sps_duplex'
7
6
 
8
7
 
9
- class SPSChat
8
+ class SPSChat < SPSDuplex
10
9
 
11
10
  def initialize(host: 'localhost', port: '8080', \
12
11
  userid: 'user' + (0..1000).to_a.sample.to_s, room: '')
13
12
 
14
- @userid = userid
15
-
16
- sps = SPSSub.new host: host, port: port, callback: self
17
- puts 'connecting ...'
18
- sleep 1 # give it a second to connect
19
-
20
- topic = ['chat']
21
- topic << room if room.length > 0
22
-
23
- Thread.new { sps.subscribe topic: (topic + ['#']).join('/') }
24
-
25
- @pub = SPSPub.new address: host, port: port
26
-
27
- topic << userid
28
- @topic = topic.join('/')
29
-
30
- end
31
-
32
- def send(msg)
33
-
34
- @pub.notice ("%s: %s" % [@topic, msg])
13
+ @userid = userid
14
+ super(host: host, port: port, topic: 'chat',
15
+ sub_topic: '#', pub_topic: userid)
35
16
 
36
17
  end
37
18
 
@@ -40,9 +21,7 @@ class SPSChat
40
21
  @pub.notice ("%s/typing: %s" % [@topic, c])
41
22
 
42
23
  end
43
-
44
-
45
-
24
+
46
25
  # used by the callback routine
47
26
  #
48
27
  def ontopic(topic, msg)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sps_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  s9dItOR/wNvg6SaW6COsX0wSHRUDvZm00WV5IykZk86V0G0jIVdbQxW6CMs/LzbZ
31
31
  y7I=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-02-06 00:00:00.000000000 Z
33
+ date: 2018-02-07 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sps_duplex
metadata.gz.sig CHANGED
Binary file