rakie 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rakie/version.rb +1 -1
- data/lib/rakie/websocket.rb +5 -5
- data/lib/rakie/websocket_server.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81b73eacd5a896ae3c13192543965d353a0b2dcd1e1ae021664e91793d130d77
|
4
|
+
data.tar.gz: bf30ef52373d98df118064c99aaaf7465e6ac8f684d0d49bea01f7d9c6f1a5ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a2152503ca81745b8ed0cc467826cd8efd4d8006b8760ed102500f80c3bc88bf946196d03bc3242f87e7db512152147781384be05d891d51fa4aca4928428d2
|
7
|
+
data.tar.gz: 29934b5f3ecf636d047c04b00a83e45ddf54a581476f65b23cfe106f231c9cf399536d42f5b2b194ed96c747c41639999be7009e4521481ae989727b4902e5eb
|
data/lib/rakie/version.rb
CHANGED
data/lib/rakie/websocket.rb
CHANGED
@@ -22,7 +22,7 @@ module Rakie
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def on_recv(channel, data)
|
25
|
-
|
25
|
+
Log.debug("Rakie::Websocket recv: #{data}")
|
26
26
|
|
27
27
|
# @type [WebsocketMessage] request
|
28
28
|
message = @recv_message
|
@@ -34,7 +34,7 @@ module Rakie
|
|
34
34
|
|
35
35
|
len = message.parse(data)
|
36
36
|
|
37
|
-
Log.debug("Rakie::Websocket receive message: #{message.to_s}")
|
37
|
+
Log.debug("Rakie::Websocket receive message: #{message.to_s} parse with #{len}")
|
38
38
|
|
39
39
|
if message.parse_status == ParseStatus::COMPLETE
|
40
40
|
response = WebsocketMessage.new
|
@@ -69,7 +69,7 @@ module Rakie
|
|
69
69
|
channel.close
|
70
70
|
|
71
71
|
Log.debug("Rakie::Websocket: Illegal message")
|
72
|
-
return
|
72
|
+
return 0
|
73
73
|
end
|
74
74
|
|
75
75
|
return len
|
@@ -109,7 +109,7 @@ module Rakie
|
|
109
109
|
end
|
110
110
|
|
111
111
|
send_message = ws_message.to_s
|
112
|
-
@send_messages <<
|
112
|
+
@send_messages << ws_message
|
113
113
|
|
114
114
|
Log.debug("Rakie::Websocket send: #{send_message}")
|
115
115
|
|
@@ -135,4 +135,4 @@ module Rakie
|
|
135
135
|
@channel.write(send_message) # Response data
|
136
136
|
end
|
137
137
|
end
|
138
|
-
end
|
138
|
+
end
|
@@ -5,7 +5,7 @@ module Rakie
|
|
5
5
|
@delegate = delegate
|
6
6
|
|
7
7
|
if http_server == nil
|
8
|
-
http_server = HttpServer.new(host, port)
|
8
|
+
http_server = HttpServer.new(host: host, port: port)
|
9
9
|
end
|
10
10
|
|
11
11
|
@host = http_server.host
|
@@ -26,7 +26,6 @@ module Rakie
|
|
26
26
|
|
27
27
|
if @delegate
|
28
28
|
@delegate.on_connect(ws_client)
|
29
|
-
return
|
30
29
|
end
|
31
30
|
|
32
31
|
@clients[channel] = ws_client
|
@@ -52,8 +51,10 @@ module Rakie
|
|
52
51
|
client = @clients[channel]
|
53
52
|
|
54
53
|
if client
|
55
|
-
client.on_recv(channel, data)
|
54
|
+
return client.on_recv(channel, data)
|
56
55
|
end
|
56
|
+
|
57
|
+
return data.length
|
57
58
|
end
|
58
59
|
|
59
60
|
def on_send(channel)
|
@@ -70,6 +71,8 @@ module Rakie
|
|
70
71
|
if client
|
71
72
|
client.on_close(channel)
|
72
73
|
end
|
74
|
+
|
75
|
+
@clients.delete(channel)
|
73
76
|
end
|
74
77
|
|
75
78
|
def send(message, is_binary=false); end
|