em-websocket 0.1.4 → 0.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.
@@ -1,73 +0,0 @@
1
- = EM-WebSocket
2
-
3
- EventMachine based, async WebSocket server. Take a look at examples directory, or
4
- check out the blog post below:
5
- - http://www.igvita.com/2009/12/22/ruby-websockets-tcp-for-the-browser/
6
-
7
- == Simple server example
8
-
9
- EventMachine.run {
10
-
11
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
12
- ws.onopen {
13
- puts "WebSocket connection open"
14
-
15
- # publish message to the client
16
- ws.send "Hello Client"
17
- }
18
-
19
- ws.onclose { puts "Connection closed" }
20
- ws.onmessage { |msg|
21
- puts "Recieved message: #{msg}"
22
- ws.send "Pong: #{msg}"
23
- }
24
- end
25
- }
26
-
27
- == Secure server
28
-
29
- It is possible to accept secure wss:// connections by passing :secure => true when opening the connection. Safari 5 does not currently support prompting on untrusted SSL certificates therefore using signed certificates is highly recommended. Pass a :tls_options hash containing keys as described in http://eventmachine.rubyforge.org/EventMachine/Connection.html#M000296
30
-
31
- For example,
32
-
33
- EventMachine::WebSocket.start({
34
- :host => "0.0.0.0",
35
- :port => 443
36
- :secure => true,
37
- :tls_options => {
38
- :private_key_file => "/private/key",
39
- :cert_chain_file => "/ssl/certificate"
40
- }
41
- }) do |ws|
42
- ...
43
- end
44
-
45
- == Examples
46
- - examples/multicast.rb - broadcast all ruby tweets to all subscribers
47
- - examples/echo.rb - server <> client exchange via a websocket
48
- - http://github.com/rubenfonseca/twitter-amqp-websocket-example
49
-
50
- == License
51
-
52
- (The MIT License)
53
-
54
- Copyright (c) 2009 Ilya Grigorik
55
-
56
- Permission is hereby granted, free of charge, to any person obtaining
57
- a copy of this software and associated documentation files (the
58
- 'Software'), to deal in the Software without restriction, including
59
- without limitation the rights to use, copy, modify, merge, publish,
60
- distribute, sublicense, and/or sell copies of the Software, and to
61
- permit persons to whom the Software is furnished to do so, subject to
62
- the following conditions:
63
-
64
- The above copyright notice and this permission notice shall be
65
- included in all copies or substantial portions of the Software.
66
-
67
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
68
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
69
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
70
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
71
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
72
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
73
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.4
@@ -1,19 +0,0 @@
1
- require 'lib/em-websocket'
2
- require 'sinatra/base'
3
- require 'thin'
4
-
5
- EM.run do
6
- class App < Sinatra::Base
7
- get '/' do
8
-
9
- end
10
- end
11
-
12
- EM::WebSocket.start(:host => '0.0.0.0', :port => 3001) do
13
- # Websocket code here
14
- end
15
-
16
- # You could also use Rainbows! instead of Thin.
17
- # Any EM based Rack handler should do.
18
- # Thin.start App, '0.0.0.0', 3000
19
- end