rfc-ws-client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -4
- data/examples/echo.rb +3 -3
- data/lib/rfc-ws-client/version.rb +2 -2
- data/lib/rfc-ws-client.rb +2 -2
- data/rfc-ws-client.gemspec +2 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -1,16 +1,27 @@
|
|
1
|
-
# RFC
|
1
|
+
# RFC WebSocket Client (rfc-ws-client)
|
2
2
|
|
3
|
-
A simple RFC 6455 (
|
3
|
+
A simple (more-or-less) RFC 6455 (WebSocket) compatible client without external dependencies.
|
4
|
+
|
5
|
+
Currently doesn't support fragmentation.
|
6
|
+
|
7
|
+
Includes source code from [em-ws-client](https://github.com/dansimpson/em-ws-client) and [web-socket-ruby](https://github.com/gimite/web-socket-ruby).
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
8
12
|
|
9
|
-
|
13
|
+
```ruby
|
14
|
+
gem 'rfc-ws-client'
|
15
|
+
```
|
10
16
|
|
11
17
|
## Usage
|
12
18
|
|
13
|
-
|
19
|
+
```ruby
|
20
|
+
ws = RfcWebSocket::WebSocket.new("wss://echo.websocket.org")
|
21
|
+
ws.send_message("test")
|
22
|
+
ws.receive # => "test"
|
23
|
+
ws.close
|
24
|
+
```
|
14
25
|
|
15
26
|
## Contributing
|
16
27
|
|
data/examples/echo.rb
CHANGED
@@ -2,14 +2,14 @@ $: << File.dirname(__FILE__) + "/../lib"
|
|
2
2
|
|
3
3
|
require "rfc-ws-client"
|
4
4
|
|
5
|
-
ws =
|
5
|
+
ws = RfcWebSocket::WebSocket.new("ws://localhost:9001/getCaseCount")
|
6
6
|
count = ws.receive()[0].to_i
|
7
7
|
ws.close
|
8
8
|
|
9
9
|
(1..count).each do |i|
|
10
10
|
puts "#{i}/#{count}"
|
11
11
|
begin
|
12
|
-
ws =
|
12
|
+
ws = RfcWebSocket::WebSocket.new "ws://localhost:9001/runCase?&case=#{i}&agent=rfc-ws-client"
|
13
13
|
while true
|
14
14
|
data, binary = ws.receive
|
15
15
|
break if data.nil?
|
@@ -20,5 +20,5 @@ ws.close
|
|
20
20
|
end
|
21
21
|
|
22
22
|
puts "Updating reports and shutting down"
|
23
|
-
ws =
|
23
|
+
ws = RfcWebSocket::WebSocket.new "ws://localhost:9001/updateReports?agent=rfc-ws-client"
|
24
24
|
ws.receive
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0.
|
1
|
+
module RfcWebSocket
|
2
|
+
VERSION = "0.0.2"
|
3
3
|
end
|
data/lib/rfc-ws-client.rb
CHANGED
data/rfc-ws-client.gemspec
CHANGED
@@ -5,10 +5,10 @@ require 'rfc-ws-client/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "rfc-ws-client"
|
8
|
-
gem.version =
|
8
|
+
gem.version = RfcWebSocket::VERSION
|
9
9
|
gem.authors = ["Lucas Clemente"]
|
10
10
|
gem.email = ["luke.clemente@gmail.com"]
|
11
|
-
gem.summary = %q{A simple
|
11
|
+
gem.summary = %q{A simple WebSocket client in ruby}
|
12
12
|
gem.homepage = "https://github.com/lucas-clemente/rfc-ws-client"
|
13
13
|
|
14
14
|
gem.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfc-ws-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -50,5 +50,5 @@ rubyforge_project:
|
|
50
50
|
rubygems_version: 1.8.23
|
51
51
|
signing_key:
|
52
52
|
specification_version: 3
|
53
|
-
summary: A simple
|
53
|
+
summary: A simple WebSocket client in ruby
|
54
54
|
test_files: []
|