rakie 0.0.6 → 0.0.7

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: 6aa5c872ec3bdf47d4f33f08f12f6ba6c3521553c9411c284d01b5efc6a63431
4
- data.tar.gz: 0ed904078c4aa1bdbf6d9564be3b381a5ae6ca1c2831256c2fadff5cd449c81d
3
+ metadata.gz: d49cbaec5f721e084610be70c71ec27438c1fc45433eea9d54b9b72ac89f6b38
4
+ data.tar.gz: 49466ddeb64dee351f28453c185f392a37aeb4129abc14430911cd9651ca739d
5
5
  SHA512:
6
- metadata.gz: 80823efc97c0d28c64d0871149118a5df0bebd19623a7b7088b9831218e8e0cee8e8a32901a010af3ffdb5e24ce86d5892dac8f5638541427e151e60209738c2
7
- data.tar.gz: 9c747c282c958a45b307eba5e9bf451f513c8337106a4c1aaf59b8b6b4809ce915607e91ca544af48149b9faa7418041fea03adf6fca06580014bd1c51765308
6
+ metadata.gz: 4e66c1558d9f29d382f6a6996241562eed1ea56710bc1b81dcdbec8063db4141d45f7c65a1f395199aadbd693807cd957606e61d8d2423175ba1f5e30711a36a
7
+ data.tar.gz: 34e7343b3c0c1f63dedec91f0eef352d24fae53f025fb158080d4418f0d0ce526ce96de8dd2d9229e1ac7588f7d252669aa7f9d666446ac5559210e30e13aa01
@@ -13,10 +13,13 @@ module Rakie
13
13
  end
14
14
  end
15
15
 
16
- attr_reader :channel, :opt
16
+ attr_reader :channel, :opt, :host, :port
17
17
 
18
- def initialize(delegate=nil)
19
- @channel = TCPServerChannel.new('127.0.0.1', 10086, self)
18
+ def initialize(host: '127.0.0.1', port: 10086, delegate: nil)
19
+ @host = host
20
+ @port = port
21
+
22
+ @channel = TCPServerChannel.new(host, port, self)
20
23
 
21
24
  # @type [Hash{Channel=>Session}]
22
25
  @sessions = {}
@@ -123,5 +126,9 @@ module Rakie
123
126
  end
124
127
  end
125
128
  end
129
+
130
+ def on_close(channel)
131
+ @sessions.delete(channel)
132
+ end
126
133
  end
127
134
  end
data/lib/rakie/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Rakie
2
- VERSION = [0, 0, 6]
2
+ VERSION = [0, 0, 7]
3
3
 
4
4
  def self.version_s
5
5
  VERSION.join('.')
@@ -109,6 +109,7 @@ module Rakie
109
109
  end
110
110
 
111
111
  send_message = ws_message.to_s
112
+ @send_messages << send_message
112
113
 
113
114
  Log.debug("Rakie::Websocket send: #{send_message}")
114
115
 
@@ -1,13 +1,16 @@
1
1
  module Rakie
2
2
  class WebsocketServer < Websocket
3
3
  # @param [Rakie::HttpServer] http_server
4
- def initialize(delegate=nil, http_server=nil)
4
+ def initialize(host: '127.0.0.1', port: 10086, delegate: nil, http_server: nil)
5
5
  @delegate = delegate
6
6
 
7
7
  if http_server == nil
8
- http_server = HttpServer.new('127.0.0.1', 10086, self)
8
+ http_server = HttpServer.new(host, port)
9
9
  end
10
10
 
11
+ @host = http_server.host
12
+ @port = http_server.port
13
+
11
14
  http_server.opt[:websocket_delegate] = self
12
15
  @channel = http_server.channel
13
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakit Liang
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  requirements: []
55
- rubygems_version: 3.0.9
55
+ rubygems_version: 3.1.2
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: Rakie!