websocket-eventmachine-client 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +14 -1
- data/lib/websocket/eventmachine/client.rb +13 -1
- data/lib/websocket/eventmachine/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c79efbc5ca7777083632533f4495bfe97a7a7620
|
4
|
+
data.tar.gz: 6a39986df45187e9b931996fb30f1e0729556217
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46ad7f7786e39411f2d6db934491d355a9a4736e2bdcc61125c5605d45a3ae5f94029324174be4422dcc4a87f16198c890787d7335a2c455dbbddc02907a9710
|
7
|
+
data.tar.gz: 5b711ff0d284a0af45ad2ce60fb17652a11ae07fdaade33cf448679ae8dfae3b931da09e30fd9487d4df3624f08c03cf67480b267cdf396f477754826a25c187
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -43,6 +43,19 @@ EM.run do
|
|
43
43
|
end
|
44
44
|
```
|
45
45
|
|
46
|
+
### UNIX Domain client
|
47
|
+
|
48
|
+
You can connect to a local UNIX domain socket instead of a remote `TCP` socket using `connect_unix_domain`:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
EM.run do
|
52
|
+
ws = WebSocket::EventMachine::Client.connect_unix_domain('/var/run/wss.sock')
|
53
|
+
# . . .
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
You can optionally specify the `:version`, `:headers`, and `:ssl` options to the method.
|
58
|
+
|
46
59
|
## Options
|
47
60
|
|
48
61
|
Following options can be passed to WebSocket::EventMachine::Client initializer:
|
@@ -158,7 +171,7 @@ Sends message to server.
|
|
158
171
|
|
159
172
|
Parameters:
|
160
173
|
|
161
|
-
- `[String] message` - message that should be sent to
|
174
|
+
- `[String] message` - message that should be sent to server
|
162
175
|
- `[Hash] params` - params for message(optional)
|
163
176
|
- `[Symbol] :type` - type of message. Valid values are :text, :binary(default is :text)
|
164
177
|
|
@@ -19,6 +19,7 @@ module WebSocket
|
|
19
19
|
# @param args [Hash] The request arguments
|
20
20
|
# @option args [String] :host The host IP/DNS name
|
21
21
|
# @option args [Integer] :port The port to connect too(default = 80)
|
22
|
+
# @option args [String] :uri Full URI for server(optional - use instead of host/port combination)
|
22
23
|
# @option args [Integer] :version Version of protocol to use(default = 13)
|
23
24
|
# @option args [Hash] :headers HTTP headers to use in the handshake
|
24
25
|
# @option args [Boolean] :ssl Force SSL/TLS connection
|
@@ -41,6 +42,17 @@ module WebSocket
|
|
41
42
|
|
42
43
|
::EventMachine.connect host, port, self, args
|
43
44
|
end
|
45
|
+
|
46
|
+
# Make a websocket connection to a UNIX-domain socket.
|
47
|
+
# @param socketname [String] Unix domain socket (local fully-qualified path)
|
48
|
+
# @param args [Hash] Arguments for connection
|
49
|
+
# @option args [Integer] :version Version of protocol to use(default = 13)
|
50
|
+
# @option args [Hash] :headers HTTP headers to use in the handshake
|
51
|
+
def self.connect_unix_domain(socketname, args = {})
|
52
|
+
fail ArgumentError, 'invalid socket' unless File.socket?(socketname)
|
53
|
+
args[:host] ||= 'localhost'
|
54
|
+
::EventMachine.connect_unix_domain socketname, self, args
|
55
|
+
end
|
44
56
|
|
45
57
|
# Initialize connection
|
46
58
|
# @param args [Hash] Arguments for connection
|
@@ -125,7 +137,7 @@ module WebSocket
|
|
125
137
|
# message - string with ping message
|
126
138
|
def onping(&blk); super; end
|
127
139
|
|
128
|
-
# Called when
|
140
|
+
# Called when pong message is received
|
129
141
|
# One parameter passed to block:
|
130
142
|
# message - string with pong message
|
131
143
|
def onpong(&blk); super; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocket-eventmachine-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Potocki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-eventmachine-base
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.5.1
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: WebSocket client for Ruby
|