libwebsocket 0.1.6 → 0.1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.6.1 / 2012-11-19
4
+
5
+ - Fix `uninitialized constant LibWebSocket::OpeningHandshake::Forwardable` error
6
+
3
7
  ## 0.1.6 / 2012-11-18
4
8
 
5
9
  - Migrate to websocket gem
data/README.md CHANGED
@@ -1,85 +1,11 @@
1
- # LibWebSocket [![](http://travis-ci.org/imanel/libwebsocket.png)](http://travis-ci.org/imanel/libwebsocket)
1
+ # LibWebSocket
2
+ [![Build Status](https://travis-ci.org/imanel/libwebsocket.png)](http://travis-ci.org/imanel/libwebsocket) [![Dependency Status](https://gemnasium.com/imanel/libwebsocket.png)](http://gemnasium.com/imanel/libwebsocket)
2
3
 
3
4
  A WebSocket message parser/constructor. It is not a server and is not meant to
4
5
  be one. It can be used in any server, event loop etc.
5
6
 
6
7
  **Note:** this implementation is supporting only hixie -75 and -76 drafts. Current development of newer drafts are handled within [websocket-ruby](https://github.com/imanel/websocket-ruby) gem and if you are starting new project it will be best to use it instead of libwebsocket. However, if you are already using libwebsocket then you don't need to hurry with transition - this gem will use websocket-rack to support newer drafts.
7
8
 
8
- ## Server handshake
9
-
10
- h = LibWebSocket::OpeningHandshake::Server.new
11
-
12
- # Parse client request
13
- h.parse \<<EOF
14
- GET /demo HTTP/1.1
15
- Upgrade: WebSocket
16
- Connection: Upgrade
17
- Host: example.com
18
- Origin: http://example.com
19
- Sec-WebSocket-Key1: 18x 6]8vM;54 *(5: { U1]8 z [ 8
20
- Sec-WebSocket-Key2: 1_ tx7X d < nw 334J702) 7]o}` 0
21
-
22
- Tm[K T2u
23
- EOF
24
-
25
- h.error # Check if there were any errors
26
- h.done? # Returns true
27
-
28
- # Create response
29
- h.to_s # HTTP/1.1 101 WebSocket Protocol Handshake
30
- # Upgrade: WebSocket
31
- # Connection: Upgrade
32
- # Sec-WebSocket-Origin: http://example.com
33
- # Sec-WebSocket-Location: ws://example.com/demo
34
- #
35
- # fQJ,fN/4F4!~K~MH
36
-
37
- ## Client handshake
38
-
39
- h = LibWebSocket::OpeningHandshake::Client.new(url => 'ws://example.com')
40
-
41
- # Create request
42
- h.to_s # GET /demo HTTP/1.1
43
- # Upgrade: WebSocket
44
- # Connection: Upgrade
45
- # Host: example.com
46
- # Origin: http://example.com
47
- # Sec-WebSocket-Key1: 18x 6]8vM;54 *(5: { U1]8 z [ 8
48
- # Sec-WebSocket-Key2: 1_ tx7X d < nw 334J702) 7]o}` 0
49
- #
50
- # Tm[K T2u
51
-
52
- # Parse server response
53
- h.parse \<<EOF
54
- HTTP/1.1 101 WebSocket Protocol Handshake
55
- Upgrade: WebSocket
56
- Connection: Upgrade
57
- Sec-WebSocket-Origin: http://example.com
58
- Sec-WebSocket-Location: ws://example.com/demo
59
-
60
- fQJ,fN/4F4!~K~MH
61
- EOF
62
-
63
- h.error # Check if there were any errors
64
- h.done? # Returns true
65
-
66
- ## Parsing and constructing frames
67
-
68
- # Create frame
69
- frame = LibWebSocket::Frame.new('123')
70
- frame.to_s # \x00123\xff
71
-
72
- # Parse frames
73
- frame = LibWebSocket::Frame.new
74
- frame.append("123\x00foo\xff56\x00bar\xff789")
75
- frame.next # foo
76
- frame.next # bar
77
-
78
- ## Examples
79
-
80
- For examples on how to use LibWebSocket with various event loops see
81
- examples directory in the repository.
82
-
83
9
  ## Copyright
84
10
 
85
11
  Copyright (C) 2012, Bernard Potocki.
@@ -1,3 +1,4 @@
1
+ require 'forwardable'
1
2
  module LibWebSocket
2
3
  # This is a base class for LibWebSocket::OpeningHandshake::Client and LibWebSocket::OpeningHandshake::Server.
3
4
  class OpeningHandshake
@@ -1,3 +1,3 @@
1
1
  module LibWebSocket
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.6.1'
3
3
  end
@@ -9,9 +9,9 @@ class TestServerOpeningHandshake < Test::Unit::TestCase
9
9
  "Upgrade: WebSocket\x0d\x0a" +
10
10
  "Connection: Upgrade\x0d\x0a" +
11
11
  "Host: example.com\x0d\x0a" +
12
- "Sec-WebSocket-Key1: #{h.controller.key1}\x0d\x0a" +
13
- "Sec-WebSocket-Key2: #{h.controller.key2}\x0d\x0a" +
14
- "\x0d\x0a#{h.controller.key3}"
12
+ "Sec-WebSocket-Key1: #{h.controller.send(:key1)}\x0d\x0a" +
13
+ "Sec-WebSocket-Key2: #{h.controller.send(:key2)}\x0d\x0a" +
14
+ "\x0d\x0a#{h.controller.send(:key3)}"
15
15
 
16
16
  h = LibWebSocket::OpeningHandshake::Client.new(:url => 'ws://example.com')
17
17
 
@@ -19,9 +19,9 @@ class TestServerOpeningHandshake < Test::Unit::TestCase
19
19
  "Upgrade: WebSocket\x0d\x0a" +
20
20
  "Connection: Upgrade\x0d\x0a" +
21
21
  "Host: example.com\x0d\x0a" +
22
- "Sec-WebSocket-Key1: #{h.controller.key1}\x0d\x0a" +
23
- "Sec-WebSocket-Key2: #{h.controller.key2}\x0d\x0a" +
24
- "\x0d\x0a#{h.controller.key3}"
22
+ "Sec-WebSocket-Key1: #{h.controller.send(:key1)}\x0d\x0a" +
23
+ "Sec-WebSocket-Key2: #{h.controller.send(:key2)}\x0d\x0a" +
24
+ "\x0d\x0a#{h.controller.send(:key3)}"
25
25
 
26
26
  assert !h.done?
27
27
  assert h.parse('')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libwebsocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.6.1
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-18 00:00:00.000000000 Z
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: websocket
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  segments:
85
85
  - 0
86
- hash: -4506301570578533171
86
+ hash: -2175210411594514962
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: -4506301570578533171
95
+ hash: -2175210411594514962
96
96
  requirements: []
97
97
  rubyforge_project:
98
98
  rubygems_version: 1.8.24