websocket_parser 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +0 -4
- data/lib/websocket/message.rb +5 -4
- data/lib/websocket/version.rb +1 -1
- data/spec/websocket/message_spec.rb +8 -0
- data/spec/websocket/parser_spec.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b06b012bde86cc8f738bb495171011343eb5e5
|
4
|
+
data.tar.gz: 52b426bacfe7868cced01be9f31fbdb6d510b4bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc4e078ff80f30e66e9880a7db3e263e9cd458d8e2b85ffb1e9f86a611e6e0f545d3eb663e77898f4c8504076c097165bc282b1b94a4e7b1593587bd8990a55
|
7
|
+
data.tar.gz: 46602d290abfc3bb7538e2439522b4ff14ce2ec5ccf4fb104ceddc93eb2850d8761cfadaf083e5bf78e6c82c3455c97b1b4ae1428be6158363f7c2646d1926a2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/websocket/message.rb
CHANGED
@@ -3,13 +3,14 @@ module WebSocket
|
|
3
3
|
attr_reader :type, :mask_key, :status_code, :payload, :status_message
|
4
4
|
|
5
5
|
# Return a new ping message
|
6
|
-
def self.ping
|
7
|
-
new(
|
6
|
+
def self.ping(payload = '')
|
7
|
+
new(payload, :ping)
|
8
8
|
end
|
9
9
|
|
10
10
|
# Return a new pong message
|
11
|
-
def self.pong
|
12
|
-
|
11
|
+
def self.pong(ping = nil)
|
12
|
+
payload = ping ? ping.payload : ''
|
13
|
+
new(payload, :pong)
|
13
14
|
end
|
14
15
|
|
15
16
|
# Return a new close message
|
data/lib/websocket/version.rb
CHANGED
@@ -39,4 +39,12 @@ describe WebSocket::Message do
|
|
39
39
|
it "does not allow a status message without status code" do
|
40
40
|
expect{ WebSocket::Message.close(nil, 'Bye') }.to raise_error(ArgumentError)
|
41
41
|
end
|
42
|
+
|
43
|
+
it "can create a pong message from a ping message" do
|
44
|
+
ping = WebSocket::Message.ping('Roman Ping Pong')
|
45
|
+
pong = WebSocket::Message.pong(ping)
|
46
|
+
|
47
|
+
pong.type.should == :pong
|
48
|
+
pong.payload.should == 'Roman Ping Pong'
|
49
|
+
end
|
42
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocket_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alberto Fernandez-Capel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|