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 +4 -4
- data/lib/rakie/http_server.rb +10 -3
- data/lib/rakie/version.rb +1 -1
- data/lib/rakie/websocket.rb +1 -0
- data/lib/rakie/websocket_server.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49cbaec5f721e084610be70c71ec27438c1fc45433eea9d54b9b72ac89f6b38
|
4
|
+
data.tar.gz: 49466ddeb64dee351f28453c185f392a37aeb4129abc14430911cd9651ca739d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e66c1558d9f29d382f6a6996241562eed1ea56710bc1b81dcdbec8063db4141d45f7c65a1f395199aadbd693807cd957606e61d8d2423175ba1f5e30711a36a
|
7
|
+
data.tar.gz: 34e7343b3c0c1f63dedec91f0eef352d24fae53f025fb158080d4418f0d0ce526ce96de8dd2d9229e1ac7588f7d252669aa7f9d666446ac5559210e30e13aa01
|
data/lib/rakie/http_server.rb
CHANGED
@@ -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
|
19
|
-
@
|
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
data/lib/rakie/websocket.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
module Rakie
|
2
2
|
class WebsocketServer < Websocket
|
3
3
|
# @param [Rakie::HttpServer] http_server
|
4
|
-
def initialize(delegate
|
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(
|
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.
|
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.
|
55
|
+
rubygems_version: 3.1.2
|
56
56
|
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: Rakie!
|