faye-websocket 0.4.7 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of faye-websocket might be problematic. Click here for more details.
- data/CHANGELOG.md +81 -0
- data/README.md +408 -0
- data/examples/app.rb +4 -1
- data/examples/autobahn_client.rb +8 -6
- data/examples/client.rb +2 -1
- data/examples/config.ru +6 -9
- data/{spec → examples}/rainbows.conf +0 -0
- data/examples/server.rb +10 -1
- data/lib/faye/adapters/rainbows.rb +15 -16
- data/lib/faye/adapters/rainbows_client.rb +15 -16
- data/lib/faye/adapters/thin.rb +15 -16
- data/lib/faye/eventsource.rb +38 -46
- data/lib/faye/rack_stream.rb +70 -0
- data/lib/faye/websocket.rb +39 -162
- data/lib/faye/websocket/api.rb +70 -60
- data/lib/faye/websocket/api/event.rb +1 -1
- data/lib/faye/websocket/api/event_target.rb +35 -12
- data/lib/faye/websocket/client.rb +5 -38
- metadata +62 -45
- data/CHANGELOG.txt +0 -74
- data/README.rdoc +0 -366
- data/ext/faye_websocket_mask/FayeWebsocketMaskService.java +0 -61
- data/ext/faye_websocket_mask/extconf.rb +0 -5
- data/ext/faye_websocket_mask/faye_websocket_mask.c +0 -33
- data/lib/faye/websocket/draft75_parser.rb +0 -87
- data/lib/faye/websocket/draft76_parser.rb +0 -84
- data/lib/faye/websocket/hybi_parser.rb +0 -321
- data/lib/faye/websocket/hybi_parser/handshake.rb +0 -78
- data/lib/faye/websocket/hybi_parser/stream_reader.rb +0 -29
- data/lib/faye/websocket/utf8_match.rb +0 -8
- data/spec/faye/websocket/client_spec.rb +0 -162
- data/spec/faye/websocket/draft75_parser_examples.rb +0 -48
- data/spec/faye/websocket/draft75_parser_spec.rb +0 -27
- data/spec/faye/websocket/draft76_parser_spec.rb +0 -34
- data/spec/faye/websocket/hybi_parser_spec.rb +0 -149
- data/spec/server.crt +0 -15
- data/spec/server.key +0 -15
- data/spec/spec_helper.rb +0 -68
data/spec/server.crt
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
-----BEGI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require 'thin'
|
6
|
-
Thin::Logging.silent = true
|
7
|
-
require 'rainbows'
|
8
|
-
Unicorn::Configurator::DEFAULTS[:logger] = Logger.new(StringIO.new)
|
9
|
-
end
|
10
|
-
|
11
|
-
require File.expand_path('../../lib/faye/websocket', __FILE__)
|
12
|
-
require File.expand_path('../../vendor/em-rspec/lib/em-rspec', __FILE__)
|
13
|
-
require File.expand_path('../faye/websocket/draft75_parser_examples', __FILE__)
|
14
|
-
|
15
|
-
module EncodingHelper
|
16
|
-
def encode(message)
|
17
|
-
message.respond_to?(:force_encoding) ?
|
18
|
-
message.force_encoding("UTF-8") :
|
19
|
-
message
|
20
|
-
end
|
21
|
-
|
22
|
-
def bytes(string)
|
23
|
-
string.bytes.to_a
|
24
|
-
end
|
25
|
-
|
26
|
-
def parse(bytes)
|
27
|
-
@parser.parse(bytes.pack('C*'))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class EchoServer
|
32
|
-
def call(env)
|
33
|
-
socket = Faye::WebSocket.new(env, ["echo"])
|
34
|
-
socket.onmessage = lambda do |event|
|
35
|
-
socket.send(event.data)
|
36
|
-
end
|
37
|
-
socket.rack_response
|
38
|
-
end
|
39
|
-
|
40
|
-
def listen(port, backend, ssl = false)
|
41
|
-
case backend
|
42
|
-
when :rainbows
|
43
|
-
rackup = Unicorn::Configurator::RACKUP
|
44
|
-
rackup[:port] = port
|
45
|
-
rackup[:set_listener] = true
|
46
|
-
options = rackup[:options]
|
47
|
-
options[:config_file] = File.expand_path('../rainbows.conf', __FILE__)
|
48
|
-
@server = Rainbows::HttpServer.new(self, options)
|
49
|
-
@server.start
|
50
|
-
when :thin
|
51
|
-
Rack::Handler.get('thin').run(self, :Port => port) do |s|
|
52
|
-
if ssl
|
53
|
-
s.ssl = true
|
54
|
-
s.ssl_options = {
|
55
|
-
:private_key_file => File.expand_path('../server.key', __FILE__),
|
56
|
-
:cert_chain_file => File.expand_path('../server.crt', __FILE__)
|
57
|
-
}
|
58
|
-
end
|
59
|
-
@server = s
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def stop
|
65
|
-
@server.stop
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|