websocketio 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +7 -1
- data/lib/websocketio/client.rb +6 -3
- data/lib/websocketio/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15650d9613c290d249e87573fc8de5a835edbab6
|
4
|
+
data.tar.gz: 878f231cd511cd75abadfab7327fa87bd98d6fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f488a1b33efc880840ec60f7bd6f71a48333dbe1f1b7382b4caa98f2beddb964d25501c2ac7223371d5bf7ecfcc983b29f295b9ff95706f524e04a88b2e71ace
|
7
|
+
data.tar.gz: 79f4afd3445949c0af4adaa7072f1a4034b71f196b3fd831ff8b00e53aaacc783cea3cba8b10d3b8138d74ff193bc0b8c677d774932661e1e791b1171da30bfd
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -39,7 +39,7 @@ while c = websocket.read(1) do
|
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
|
-
### new(socket, handshake\_args) -> WebSocketIO::Client
|
42
|
+
### new(socket, handshake\_args, options = {}) -> WebSocketIO::Client
|
43
43
|
#### socket
|
44
44
|
|
45
45
|
It requires a connected socket object.
|
@@ -51,6 +51,12 @@ When you want to connect over proxy, you may use [ruby-proxifier](https://github
|
|
51
51
|
Parameters for WebSocket handshaking.
|
52
52
|
This arg is given to `WebSocket::Handshake::Client.new` which is defined at [websocket-ruby](https://github.com/imanel/websocket-ruby#client-handshake).
|
53
53
|
|
54
|
+
#### options[:write\_type]
|
55
|
+
|
56
|
+
Type (opcode) of WebSocket frame sent by this object.
|
57
|
+
[Keys in `FRAME\_TYPE` defined at websocket-ruby](https://github.com/imanel/websocket-ruby/blob/master/lib/websocket/frame/handler/handler03.rb#L9) are available.
|
58
|
+
Default is `:text`.
|
59
|
+
|
54
60
|
## Implemented
|
55
61
|
|
56
62
|
* WebSocketIO::Client
|
data/lib/websocketio/client.rb
CHANGED
@@ -7,11 +7,14 @@ require 'forwardable'
|
|
7
7
|
module WebSocketIO
|
8
8
|
class Client
|
9
9
|
extend Forwardable
|
10
|
+
attr_reader :socket
|
10
11
|
|
11
12
|
def_delegators :@filtered_socket, :read, :getc
|
12
13
|
|
13
|
-
def initialize(socket, handshake_args)
|
14
|
-
@socket
|
14
|
+
def initialize(socket, handshake_args, options = {})
|
15
|
+
@socket = socket
|
16
|
+
@options = options
|
17
|
+
|
15
18
|
@handshake = WebSocket::Handshake::Client.new(handshake_args)
|
16
19
|
@socket.write @handshake.to_s
|
17
20
|
until @handshake.finished? do
|
@@ -45,7 +48,7 @@ module WebSocketIO
|
|
45
48
|
def send_frame(params)
|
46
49
|
params = {
|
47
50
|
data: nil,
|
48
|
-
type: :text,
|
51
|
+
type: @options[:write_type] || :text,
|
49
52
|
version: @handshake.version
|
50
53
|
}.merge(params)
|
51
54
|
frame = WebSocket::Frame::Outgoing::Client.new(params)
|
data/lib/websocketio/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocketio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi Horiuchi
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".travis.yml"
|
134
|
+
- CHANGELOG.md
|
134
135
|
- Gemfile
|
135
136
|
- LICENSE.txt
|
136
137
|
- README.md
|