websocket-driver 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +266 -0
- data/ext/websocket_mask/WebsocketMaskService.java +61 -0
- data/ext/websocket_mask/extconf.rb +5 -0
- data/ext/websocket_mask/websocket_mask.c +33 -0
- data/lib/websocket/driver.rb +158 -0
- data/lib/websocket/driver/client.rb +117 -0
- data/lib/websocket/driver/draft75.rb +93 -0
- data/lib/websocket/driver/draft76.rb +97 -0
- data/lib/websocket/driver/event_emitter.rb +43 -0
- data/lib/websocket/driver/hybi.rb +368 -0
- data/lib/websocket/driver/hybi/stream_reader.rb +30 -0
- data/lib/websocket/driver/utf8_match.rb +7 -0
- metadata +95 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
module WebSocket
|
2
|
+
class Driver
|
3
|
+
|
4
|
+
class Hybi
|
5
|
+
class StreamReader
|
6
|
+
def initialize
|
7
|
+
@queue = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def read(length)
|
11
|
+
read_bytes(length)
|
12
|
+
end
|
13
|
+
|
14
|
+
def put(bytes)
|
15
|
+
return unless bytes and bytes.size > 0
|
16
|
+
@queue.concat(bytes)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def read_bytes(length)
|
22
|
+
return nil if length > @queue.size
|
23
|
+
@queue.shift(length)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module WebSocket
|
2
|
+
class Driver
|
3
|
+
# http://www.w3.org/International/questions/qa-forms-utf-8.en.php
|
4
|
+
UTF8_MATCH = /^([\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})*$/
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: websocket-driver
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- James Coglan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake-compiler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description:
|
47
|
+
email: jcoglan@gmail.com
|
48
|
+
executables: []
|
49
|
+
extensions:
|
50
|
+
- ext/websocket_mask/extconf.rb
|
51
|
+
extra_rdoc_files:
|
52
|
+
- README.md
|
53
|
+
files:
|
54
|
+
- README.md
|
55
|
+
- CHANGELOG.md
|
56
|
+
- ext/websocket_mask/websocket_mask.c
|
57
|
+
- ext/websocket_mask/WebsocketMaskService.java
|
58
|
+
- ext/websocket_mask/extconf.rb
|
59
|
+
- lib/websocket/driver/client.rb
|
60
|
+
- lib/websocket/driver/draft75.rb
|
61
|
+
- lib/websocket/driver/draft76.rb
|
62
|
+
- lib/websocket/driver/event_emitter.rb
|
63
|
+
- lib/websocket/driver/hybi/stream_reader.rb
|
64
|
+
- lib/websocket/driver/hybi.rb
|
65
|
+
- lib/websocket/driver/utf8_match.rb
|
66
|
+
- lib/websocket/driver.rb
|
67
|
+
homepage: http://github.com/faye/websocket-driver-ruby
|
68
|
+
licenses: []
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --main
|
72
|
+
- README.md
|
73
|
+
- --markup
|
74
|
+
- markdown
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 1.8.23
|
92
|
+
signing_key:
|
93
|
+
specification_version: 3
|
94
|
+
summary: WebSocket protocol handler with pluggable I/O
|
95
|
+
test_files: []
|