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 CHANGED
@@ -1,16 +1,27 @@
1
- # RFC Websocket Client (rfc-ws-client)
1
+ # RFC WebSocket Client (rfc-ws-client)
2
2
 
3
- A simple RFC 6455 (Websocket) compatible client in ruby.
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
- gem 'rfc-ws-client'
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 = RfcWebsocket::Websocket.new("ws://localhost:9001/getCaseCount")
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 = RfcWebsocket::Websocket.new "ws://localhost:9001/runCase?&case=#{i}&agent=rfc-ws-client"
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 = RfcWebsocket::Websocket.new "ws://localhost:9001/updateReports?agent=rfc-ws-client"
23
+ ws = RfcWebSocket::WebSocket.new "ws://localhost:9001/updateReports?agent=rfc-ws-client"
24
24
  ws.receive
@@ -1,3 +1,3 @@
1
- module RfcWebsocket
2
- VERSION = "0.0.1"
1
+ module RfcWebSocket
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/rfc-ws-client.rb CHANGED
@@ -8,8 +8,8 @@ require "digest/sha1"
8
8
  require 'rainbow'
9
9
  require 'base64'
10
10
 
11
- module RfcWebsocket
12
- class Websocket
11
+ module RfcWebSocket
12
+ class WebSocket
13
13
  WEB_SOCKET_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
14
14
  OPCODE_CONTINUATION = 0x01
15
15
  OPCODE_TEXT = 0x01
@@ -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 = RfcWebsocket::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 Websocket client in ruby}
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.1
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 Websocket client in ruby
53
+ summary: A simple WebSocket client in ruby
54
54
  test_files: []