async-websocket 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +3 -0
- data/.travis.yml +20 -0
- data/Gemfile +10 -0
- data/README.md +95 -0
- data/Rakefile +8 -0
- data/async-websocket.gemspec +28 -0
- data/lib/async/websocket.rb +85 -0
- data/lib/async/websocket/client.rb +89 -0
- data/lib/async/websocket/version.rb +25 -0
- data/spec/async/websocket/connection_spec.rb +54 -0
- data/spec/async/websocket/connection_spec.ru +31 -0
- data/spec/spec_helper.rb +32 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8954f1e1bb06c1e4188f6b248f2c78ee7b79ced5
|
4
|
+
data.tar.gz: 3dc3b81c1c475d07cab9281ace55bc7c4ec265f1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d452579efb8559353825d4e4771112ed5a25cc0d0abac7e3f508431a2c65795250767dddc824d1c9cd297e0e1bbff20d9d5ccc5d119be50657cb6386ce717b7e
|
7
|
+
data.tar.gz: 67d57f3cb2202e527ddd35493700612db4e166692cc7f880f2dbcaa908766bb4c711a47b0c3fa281fb463f89280c40486c54680be0179c3538957ed014a9f69b
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
dist: trusty
|
4
|
+
cache: bundler
|
5
|
+
|
6
|
+
matrix:
|
7
|
+
include:
|
8
|
+
- rvm: 2.0
|
9
|
+
- rvm: 2.1
|
10
|
+
- rvm: 2.2
|
11
|
+
- rvm: 2.3
|
12
|
+
- rvm: 2.4
|
13
|
+
- rvm: jruby-head
|
14
|
+
env: JRUBY_OPTS="--debug -X+O"
|
15
|
+
- rvm: ruby-head
|
16
|
+
- rvm: rbx-3
|
17
|
+
allow_failures:
|
18
|
+
- rvm: ruby-head
|
19
|
+
- rvm: jruby-head
|
20
|
+
- rvm: rbx-3
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Async::WebSocket
|
2
|
+
|
3
|
+
A simple asynchronous websocket client/server implementation.
|
4
|
+
|
5
|
+
[![Build Status](https://secure.travis-ci.org/socketry/async-websocket.svg)](http://travis-ci.org/socketry/async-websocket)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/socketry/async-websocket.svg)](https://codeclimate.com/github/socketry/async-websocket)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/socketry/async-websocket/badge.svg)](https://coveralls.io/r/socketry/async-websocket)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'async-websocket'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install async-websocket
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Here is how to use within `Utopia::Controller`:
|
26
|
+
|
27
|
+
on 'list' do |request|
|
28
|
+
fail! unless Async::WebSocket?(request.env)
|
29
|
+
|
30
|
+
Async::WebSocket.open(request.env) do |connection|
|
31
|
+
read, write = IO.pipe
|
32
|
+
|
33
|
+
Process.spawn("ls -lah", :out => write)
|
34
|
+
write.close
|
35
|
+
|
36
|
+
read.each_line do |line|
|
37
|
+
connection.text(line)
|
38
|
+
end
|
39
|
+
|
40
|
+
connection.close
|
41
|
+
end
|
42
|
+
|
43
|
+
succeed!
|
44
|
+
end
|
45
|
+
|
46
|
+
`connection` is an instance of [`WebSocket::Driver`][1].
|
47
|
+
|
48
|
+
[1]: https://github.com/faye/websocket-driver-ruby
|
49
|
+
|
50
|
+
If you want to handle incoming messages, you must listen for these and then handle them:
|
51
|
+
|
52
|
+
on 'echo' do |request|
|
53
|
+
fail! unless Async::WebSocket?(request.env)
|
54
|
+
|
55
|
+
Async::WebSocket.open(request.env) do |connection|
|
56
|
+
connection.on(:message) do |event|
|
57
|
+
connection.text(event.data)
|
58
|
+
connection.close
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
succeed!
|
63
|
+
end
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
|
67
|
+
1. Fork it
|
68
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
69
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
70
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
71
|
+
5. Create new Pull Request
|
72
|
+
|
73
|
+
## License
|
74
|
+
|
75
|
+
Released under the MIT license.
|
76
|
+
|
77
|
+
Copyright, 2015, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
78
|
+
|
79
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
80
|
+
of this software and associated documentation files (the "Software"), to deal
|
81
|
+
in the Software without restriction, including without limitation the rights
|
82
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
83
|
+
copies of the Software, and to permit persons to whom the Software is
|
84
|
+
furnished to do so, subject to the following conditions:
|
85
|
+
|
86
|
+
The above copyright notice and this permission notice shall be included in
|
87
|
+
all copies or substantial portions of the Software.
|
88
|
+
|
89
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
90
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
91
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
92
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
93
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
94
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
95
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
require_relative 'lib/async/websocket/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "async-websocket"
|
6
|
+
spec.version = Async::WebSocket::VERSION
|
7
|
+
spec.authors = ["Samuel Williams"]
|
8
|
+
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
+
spec.summary = %q{An async websocket library on top of websocket-driver.}
|
10
|
+
spec.homepage = ""
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.files = `git ls-files -z`.split("\x0")
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "websocket-driver", "~> 0.7.0"
|
19
|
+
|
20
|
+
spec.add_dependency "async-io"
|
21
|
+
|
22
|
+
spec.add_development_dependency "async-rspec"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "falcon"
|
28
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require_relative 'websocket/version'
|
22
|
+
require 'websocket/driver'
|
23
|
+
|
24
|
+
module Async
|
25
|
+
def self.WebSocket?(env)
|
26
|
+
::WebSocket::Driver.websocket?(env)
|
27
|
+
end
|
28
|
+
|
29
|
+
module WebSocket
|
30
|
+
class Connection
|
31
|
+
READ_BUFFER_SIZE = 1024*8
|
32
|
+
|
33
|
+
attr_reader :env, :url
|
34
|
+
|
35
|
+
def initialize(env, io)
|
36
|
+
@env = env
|
37
|
+
@io = io
|
38
|
+
|
39
|
+
scheme = Rack::Request.new(env).ssl? ? 'wss:' : 'ws:'
|
40
|
+
@url = "#{scheme}//#{env['HTTP_HOST']}#{env['REQUEST_URI']}"
|
41
|
+
|
42
|
+
@driver = ::WebSocket::Driver.rack(self)
|
43
|
+
@running = false
|
44
|
+
end
|
45
|
+
|
46
|
+
def write(string)
|
47
|
+
@io.write(string)
|
48
|
+
end
|
49
|
+
|
50
|
+
def read
|
51
|
+
@driver.parse(@io.read(READ_BUFFER_SIZE))
|
52
|
+
end
|
53
|
+
|
54
|
+
def run(&handler)
|
55
|
+
@running = true
|
56
|
+
|
57
|
+
@driver.on(:close) do
|
58
|
+
@running = false
|
59
|
+
end
|
60
|
+
|
61
|
+
@driver.on(:open) do
|
62
|
+
yield @driver if block_given?
|
63
|
+
end
|
64
|
+
|
65
|
+
@driver.start
|
66
|
+
|
67
|
+
while @running
|
68
|
+
self.read
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.open(env)
|
74
|
+
if ::WebSocket::Driver.websocket?(env)
|
75
|
+
env['rack.hijack'].call
|
76
|
+
|
77
|
+
connection = Connection.new(env, env['rack.hijack_io'])
|
78
|
+
|
79
|
+
connection.run do |driver|
|
80
|
+
yield driver
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'websocket/driver'
|
22
|
+
require 'json'
|
23
|
+
|
24
|
+
module Async
|
25
|
+
module WebSocket
|
26
|
+
# This is a basic synchronous websocket client:
|
27
|
+
class Client
|
28
|
+
EVENTS = [:open, :message, :close]
|
29
|
+
|
30
|
+
def initialize(socket, url: "ws://.")
|
31
|
+
@socket = socket
|
32
|
+
@url = url
|
33
|
+
|
34
|
+
@driver = ::WebSocket::Driver.client(self)
|
35
|
+
|
36
|
+
@queue = []
|
37
|
+
|
38
|
+
@driver.on(:error) do |error|
|
39
|
+
raise error
|
40
|
+
end
|
41
|
+
|
42
|
+
EVENTS.each do |event|
|
43
|
+
@driver.on(event) do |data|
|
44
|
+
@queue.push(data)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
@driver.start
|
49
|
+
end
|
50
|
+
|
51
|
+
attr :driver
|
52
|
+
attr :url
|
53
|
+
|
54
|
+
def next_event
|
55
|
+
while @queue.empty?
|
56
|
+
data = @socket.read(1024)
|
57
|
+
|
58
|
+
if data and !data.empty?
|
59
|
+
@driver.parse(data)
|
60
|
+
else
|
61
|
+
return nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
@queue.shift
|
66
|
+
rescue EOFError
|
67
|
+
return nil
|
68
|
+
end
|
69
|
+
|
70
|
+
def next_message
|
71
|
+
while event = next_event
|
72
|
+
if event.is_a? ::WebSocket::Driver::MessageEvent
|
73
|
+
return JSON.parse(event.data)
|
74
|
+
elsif event.is_a? ::WebSocket::Driver::CloseEvent
|
75
|
+
return nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def write(data)
|
81
|
+
@socket.write(data)
|
82
|
+
end
|
83
|
+
|
84
|
+
def close
|
85
|
+
@driver.close
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
module Async
|
22
|
+
module WebSocket
|
23
|
+
VERSION = "0.2.0"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'async/websocket'
|
22
|
+
require 'async/websocket/client'
|
23
|
+
|
24
|
+
require 'rack/test'
|
25
|
+
require 'falcon/server'
|
26
|
+
|
27
|
+
RSpec.describe Async::WebSocket::Connection do
|
28
|
+
include_context Async::RSpec::Reactor
|
29
|
+
let(:server_address) {Async::IO::Endpoint.tcp('0.0.0.0', 9000)}
|
30
|
+
let(:app) {Rack::Builder.parse_file(File.expand_path('../connection_spec.ru', __FILE__)).first}
|
31
|
+
let(:server) {Falcon::Server.new(app, [server_address])}
|
32
|
+
|
33
|
+
it "should connect to the websocket server" do
|
34
|
+
server_task = Async::Reactor.run do
|
35
|
+
server.run
|
36
|
+
end
|
37
|
+
|
38
|
+
events = []
|
39
|
+
|
40
|
+
server_address.connect do |socket|
|
41
|
+
client = Async::WebSocket::Client.new(socket)
|
42
|
+
|
43
|
+
while event = client.next_event
|
44
|
+
events << event
|
45
|
+
end
|
46
|
+
|
47
|
+
client.close # optional
|
48
|
+
end
|
49
|
+
|
50
|
+
expect(events.size).to be > 0
|
51
|
+
|
52
|
+
server_task.stop
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
require 'async/websocket'
|
3
|
+
|
4
|
+
class Upgrade
|
5
|
+
def initialize(app)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
if Async::WebSocket?(env)
|
11
|
+
Async::WebSocket.open(env) do |connection|
|
12
|
+
read, write = IO.pipe
|
13
|
+
|
14
|
+
Process.spawn("ls -lah", :out => write)
|
15
|
+
write.close
|
16
|
+
|
17
|
+
read.each_line do |line|
|
18
|
+
connection.text(line)
|
19
|
+
end
|
20
|
+
|
21
|
+
connection.close
|
22
|
+
end
|
23
|
+
else
|
24
|
+
@app.call(env)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
use Upgrade
|
30
|
+
|
31
|
+
run lambda {|env| [404, {}, []]}
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
if ENV['COVERAGE'] || ENV['TRAVIS']
|
3
|
+
begin
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter "/spec/"
|
8
|
+
end
|
9
|
+
|
10
|
+
if ENV['TRAVIS']
|
11
|
+
require 'coveralls'
|
12
|
+
Coveralls.wear!
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
warn "Could not load simplecov: #{$!}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require "bundler/setup"
|
20
|
+
require "async/websocket"
|
21
|
+
|
22
|
+
# Shared rspec helpers:
|
23
|
+
require "async/rspec"
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
# Enable flags like --only-failures and --next-failure
|
27
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
28
|
+
|
29
|
+
config.expect_with :rspec do |c|
|
30
|
+
c.syntax = :expect
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: async-websocket
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: websocket-driver
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.7.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.7.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: async-io
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: async-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: falcon
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- samuel.williams@oriontransfer.co.nz
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
121
|
+
- Gemfile
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- async-websocket.gemspec
|
125
|
+
- lib/async/websocket.rb
|
126
|
+
- lib/async/websocket/client.rb
|
127
|
+
- lib/async/websocket/version.rb
|
128
|
+
- spec/async/websocket/connection_spec.rb
|
129
|
+
- spec/async/websocket/connection_spec.ru
|
130
|
+
- spec/spec_helper.rb
|
131
|
+
homepage: ''
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.6.12
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: An async websocket library on top of websocket-driver.
|
155
|
+
test_files:
|
156
|
+
- spec/async/websocket/connection_spec.rb
|
157
|
+
- spec/async/websocket/connection_spec.ru
|
158
|
+
- spec/spec_helper.rb
|