websocket 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 1.8.7
5
5
  - 1.9.2
6
6
  - 1.9.3
7
+ - 2.0.0
7
8
  - jruby-18mode
8
9
  - jruby-19mode
9
10
  - rbx-18mode
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.5
4
+
5
+ - add support for close codes
6
+
3
7
  ## 1.0.4
4
8
 
5
9
  - nicer inspect - handful during debugging
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  - Travis CI build: [![](https://travis-ci.org/imanel/websocket-ruby.png)](http://travis-ci.org/imanel/websocket-ruby)
4
4
  - Autobahn tests: [server](http://imanel.github.com/websocket-ruby/autobahn/server/), client
5
5
 
6
- Universal Ruby library to handle WebSocket protocol. It foucses on providing abstraction layer over [WebSocket API](http://dev.w3.org/html5/websockets/) instead of providing server or client functionality.
6
+ Universal Ruby library to handle WebSocket protocol. It focuses on providing abstraction layer over [WebSocket API](http://dev.w3.org/html5/websockets/) instead of providing server or client functionality.
7
7
 
8
8
  Currently WebSocket Ruby supports all existing drafts of WebSocket, which include:
9
9
 
@@ -106,7 +106,7 @@ For examples on how to use WebSocket Ruby see examples directory in the reposito
106
106
 
107
107
  ## Native extension
108
108
 
109
- WebSocket gem is written in pure Ruby, without any dependencies or native extensions and still is one of the fastest implementations of WebSocket API. However, if you want to increase it's speed even further, I created additional gem with dedicated native extensions for both C and Java. Those extensions provide 20-30% increate in speed(more accurate comparision can be found in autobahn test results)
109
+ WebSocket gem is written in pure Ruby, without any dependencies or native extensions and still is one of the fastest implementations of WebSocket API. However, if you want to increase it's speed even further, I created additional gem with dedicated native extensions for both C and Java. Those extensions provide 20-30% increase in speed(more accurate comparison can be found in autobahn test results)
110
110
 
111
111
  In order to use native extension just install [websocket-native](http://github.com/imanel/websocket-ruby-native) gem or add it to Gemfile - WebSocket will automatically detect and load it.
112
112
 
@@ -9,9 +9,11 @@ module WebSocket
9
9
  # @param args [Hash] Arguments for frame
10
10
  # @option args [String] :data default data for frame
11
11
  # @option args [String] :type Type of frame - available types are "text", "binary", "ping", "pong" and "close"(support depends on draft version)
12
+ # @option args [Integer] :code Code for close frame. Supported by drafts > 05.
12
13
  # @option args [Integer] :version Version of draft. Currently supported version are 75, 76 and 00-13.
13
14
  def initialize(args = {})
14
15
  @type = args[:type]
16
+ @code = args[:code]
15
17
  @data = Data.new(args[:data].to_s)
16
18
  @version = args[:version] || DEFAULT_VERSION
17
19
  include_version
@@ -9,6 +9,14 @@ module WebSocket
9
9
 
10
10
  private
11
11
 
12
+ def encode_frame
13
+ if @code
14
+ @data = Data.new([@code].pack('n') + @data.to_s)
15
+ @code = nil
16
+ end
17
+ super
18
+ end
19
+
12
20
  # Since handler 5 masking should be enabled by default
13
21
  def masking?; true; end
14
22
 
@@ -1,3 +1,3 @@
1
1
  module WebSocket
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-22 00:00:00.000000000 Z
12
+ date: 2012-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec