kermit 1.0.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.
- data/Gemfile +18 -0
- data/LICENSE.txt +20 -0
- data/README.md +54 -0
- data/Rakefile +31 -0
- data/VERSION +1 -0
- data/bin/kermit +24 -0
- data/config/config.example.yml +24 -0
- data/doc/Adapter.html +533 -0
- data/doc/Converter.html +348 -0
- data/doc/DAO.html +1047 -0
- data/doc/KermitPFC.html +927 -0
- data/doc/Link.html +667 -0
- data/doc/Logging.html +401 -0
- data/doc/Logging/Settings.html +170 -0
- data/doc/RandomAdapter.html +501 -0
- data/doc/RandomConverter.html +359 -0
- data/doc/RandomPhraseGenerator.html +317 -0
- data/doc/ToUser.html +815 -0
- data/doc/TwitterAdapter.html +550 -0
- data/doc/TwitterConverter.html +598 -0
- data/doc/USMF.html +2188 -0
- data/doc/User.html +1407 -0
- data/doc/WebSocketClient.html +316 -0
- data/doc/WebSocketServer.html +427 -0
- data/doc/_index.html +270 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.LICENSE.html +73 -0
- data/doc/file.README.html +123 -0
- data/doc/file_list.html +58 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +123 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +764 -0
- data/doc/top-level-namespace.html +138 -0
- data/lib/business/adapter/adapter.rb +39 -0
- data/lib/business/adapter/random_adapter.rb +50 -0
- data/lib/business/adapter/twitter_adapter.rb +75 -0
- data/lib/business/converter/converter.rb +24 -0
- data/lib/business/converter/random_converter.rb +42 -0
- data/lib/business/converter/twitter_converter.rb +164 -0
- data/lib/business/random_phrase_generator.rb +39 -0
- data/lib/helper/DAO.rb +94 -0
- data/lib/helper/settings.rb +11 -0
- data/lib/helper/websocket_client.rb +37 -0
- data/lib/helper/websocket_server.rb +65 -0
- data/lib/kermitpfc.rb +164 -0
- data/lib/logging.rb +31 -0
- data/lib/model/USMF/USMF.rb +98 -0
- data/lib/model/USMF/link.rb +30 -0
- data/lib/model/USMF/to_user.rb +32 -0
- data/lib/model/USMF/user.rb +41 -0
- data/lib/model/templates/USMF +56 -0
- data/lib/model/templates/atom.xml +74 -0
- data/lib/model/templates/example +59 -0
- data/lib/model/templates/rss.xml +68 -0
- data/lib/model/templates/template +49 -0
- data/lib/model/templates/tweet +116 -0
- data/spec/DAO_spec.rb +64 -0
- data/spec/random_adapter_spec.rb +24 -0
- data/spec/random_converter_spec.rb +115 -0
- data/spec/random_phrase_generator_spec.rb +15 -0
- data/spec/twitter_adapter_spec.rb +24 -0
- data/spec/twitter_converter_spec.rb +132 -0
- data/websocket_client.html +20 -0
- metadata +253 -0
@@ -0,0 +1,316 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: WebSocketClient
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (W)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">WebSocketClient</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: WebSocketClient
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">WebSocketClient</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r2">Includes:</dt>
|
94
|
+
<dd class="r2"><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></dd>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dt class="r1 last">Defined in:</dt>
|
101
|
+
<dd class="r1 last">lib/helper/websocket_client.rb</dd>
|
102
|
+
|
103
|
+
</dl>
|
104
|
+
<div class="clear"></div>
|
105
|
+
|
106
|
+
<h2>Overview</h2><div class="docstring">
|
107
|
+
<div class="discussion">
|
108
|
+
<p>
|
109
|
+
A WebSocket client to help testing the WebSocket Server
|
110
|
+
</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
<p class="tag_title">Author:</p>
|
118
|
+
<ul class="author">
|
119
|
+
|
120
|
+
<li>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div class='inline'><p>
|
127
|
+
Daniel Machado Fernandez
|
128
|
+
</p>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
</li>
|
132
|
+
|
133
|
+
</ul>
|
134
|
+
<p class="tag_title">Version:</p>
|
135
|
+
<ul class="version">
|
136
|
+
|
137
|
+
<li>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<div class='inline'><p>
|
144
|
+
1.0
|
145
|
+
</p>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
</ul>
|
151
|
+
|
152
|
+
</div>
|
153
|
+
<h2>Constant Summary</h2>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<h2>Constant Summary</h2>
|
159
|
+
|
160
|
+
<h3 class="inherited">Constants included
|
161
|
+
from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
|
162
|
+
<p class="inherited"><span class='object_link'><a href="Logging.html#KermitPFC-constant" title="Logging::KermitPFC (constant)">Logging::KermitPFC</a></span></p>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<h2>
|
170
|
+
Instance Method Summary
|
171
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
172
|
+
</h2>
|
173
|
+
|
174
|
+
<ul class="summary">
|
175
|
+
|
176
|
+
<li class="public ">
|
177
|
+
<span class="summary_signature">
|
178
|
+
|
179
|
+
<a href="#start-instance_method" title="#start (instance method)">- (Object) <strong>start</strong> </a>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc"><div class='inline'><p>
|
194
|
+
Starts the WebSocket client to consume the published info in the WebSocket
|
195
|
+
Server.
|
196
|
+
</p>
|
197
|
+
</div></span>
|
198
|
+
|
199
|
+
</li>
|
200
|
+
|
201
|
+
|
202
|
+
</ul>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
|
215
|
+
<p class="inherited"><span class='object_link'><a href="Logging.html#logger-instance_method" title="Logging#logger (method)">#logger</a></span>, <span class='object_link'><a href="Logging.html#logger-class_method" title="Logging.logger (method)">logger</a></span></p>
|
216
|
+
|
217
|
+
|
218
|
+
<div id="instance_method_details" class="method_details_list">
|
219
|
+
<h2>Instance Method Details</h2>
|
220
|
+
|
221
|
+
|
222
|
+
<div class="method_details first">
|
223
|
+
<h3 class="signature first" id="start-instance_method">
|
224
|
+
|
225
|
+
- (<tt>Object</tt>) <strong>start</strong>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</h3><div class="docstring">
|
232
|
+
<div class="discussion">
|
233
|
+
<p>
|
234
|
+
Starts the WebSocket client to consume the published info in the WebSocket
|
235
|
+
Server
|
236
|
+
</p>
|
237
|
+
|
238
|
+
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
<div class="tags">
|
242
|
+
|
243
|
+
|
244
|
+
</div><table class="source_code">
|
245
|
+
<tr>
|
246
|
+
<td>
|
247
|
+
<pre class="lines">
|
248
|
+
|
249
|
+
|
250
|
+
13
|
251
|
+
14
|
252
|
+
15
|
253
|
+
16
|
254
|
+
17
|
255
|
+
18
|
256
|
+
19
|
257
|
+
20
|
258
|
+
21
|
259
|
+
22
|
260
|
+
23
|
261
|
+
24
|
262
|
+
25
|
263
|
+
26
|
264
|
+
27
|
265
|
+
28
|
266
|
+
29
|
267
|
+
30
|
268
|
+
31
|
269
|
+
32
|
270
|
+
33
|
271
|
+
34
|
272
|
+
35</pre>
|
273
|
+
</td>
|
274
|
+
<td>
|
275
|
+
<pre class="code"><span class="info file"># File 'lib/helper/websocket_client.rb', line 13</span>
|
276
|
+
|
277
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span>
|
278
|
+
|
279
|
+
<span class='const'>EventMachine</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>do</span>
|
280
|
+
|
281
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='op'>*</span><span class='int'>80</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Connecting to websockets server at ws://</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='rbrace'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='op'>*</span><span class='int'>80</span>
|
282
|
+
|
283
|
+
<span class='id identifier rubyid_http'>http</span> <span class='op'>=</span> <span class='const'>EventMachine</span><span class='op'>::</span><span class='const'>HttpRequest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ws://</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='rbrace'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rbrace'>}</span><span class='tstring_content'>/websocket</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span> <span class='symbol'>:timeout</span> <span class='op'>=></span> <span class='int'>0</span>
|
284
|
+
|
285
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_errback'>errback</span> <span class='kw'>do</span>
|
286
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>something was wrong in the websocket_client</span><span class='tstring_end'>"</span></span>
|
287
|
+
<span class='kw'>end</span>
|
288
|
+
|
289
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_callback'>callback</span> <span class='kw'>do</span>
|
290
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> : Connected to server</span><span class='tstring_end'>"</span></span>
|
291
|
+
<span class='kw'>end</span>
|
292
|
+
|
293
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_stream'>stream</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_msg'>msg</span><span class='op'>|</span>
|
294
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_msg'>msg</span>
|
295
|
+
<span class='kw'>end</span>
|
296
|
+
|
297
|
+
<span class='kw'>end</span>
|
298
|
+
|
299
|
+
<span class='kw'>end</span></pre>
|
300
|
+
</td>
|
301
|
+
</tr>
|
302
|
+
</table>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div id="footer">
|
310
|
+
Generated on Sat Aug 18 16:24:08 2012 by
|
311
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
312
|
+
0.8.2.1 (ruby-1.9.2).
|
313
|
+
</div>
|
314
|
+
|
315
|
+
</body>
|
316
|
+
</html>
|
@@ -0,0 +1,427 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: WebSocketServer
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.2.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (W)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">WebSocketServer</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: WebSocketServer
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">WebSocketServer</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r2">Includes:</dt>
|
94
|
+
<dd class="r2"><span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></dd>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dt class="r1 last">Defined in:</dt>
|
101
|
+
<dd class="r1 last">lib/helper/websocket_server.rb</dd>
|
102
|
+
|
103
|
+
</dl>
|
104
|
+
<div class="clear"></div>
|
105
|
+
|
106
|
+
<h2>Overview</h2><div class="docstring">
|
107
|
+
<div class="discussion">
|
108
|
+
<p>
|
109
|
+
WebSocket Server where the USMF messages will be published
|
110
|
+
</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
<p class="tag_title">Author:</p>
|
118
|
+
<ul class="author">
|
119
|
+
|
120
|
+
<li>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div class='inline'><p>
|
127
|
+
Daniel Machado Fernandez
|
128
|
+
</p>
|
129
|
+
</div>
|
130
|
+
|
131
|
+
</li>
|
132
|
+
|
133
|
+
</ul>
|
134
|
+
<p class="tag_title">Version:</p>
|
135
|
+
<ul class="version">
|
136
|
+
|
137
|
+
<li>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<div class='inline'><p>
|
144
|
+
1.0
|
145
|
+
</p>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
</ul>
|
151
|
+
|
152
|
+
</div>
|
153
|
+
<h2>Constant Summary</h2>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<h2>Constant Summary</h2>
|
159
|
+
|
160
|
+
<h3 class="inherited">Constants included
|
161
|
+
from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
|
162
|
+
<p class="inherited"><span class='object_link'><a href="Logging.html#KermitPFC-constant" title="Logging::KermitPFC (constant)">Logging::KermitPFC</a></span></p>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<h2>
|
170
|
+
Instance Method Summary
|
171
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
172
|
+
</h2>
|
173
|
+
|
174
|
+
<ul class="summary">
|
175
|
+
|
176
|
+
<li class="public ">
|
177
|
+
<span class="summary_signature">
|
178
|
+
|
179
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (WebSocketServer) <strong>initialize</strong> </a>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
<span class="note title constructor">constructor</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<span class="summary_desc"><div class='inline'><p>
|
196
|
+
Configures the WebSocket to works in test mode (path controversia).
|
197
|
+
</p>
|
198
|
+
</div></span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
<li class="public ">
|
204
|
+
<span class="summary_signature">
|
205
|
+
|
206
|
+
<a href="#start-instance_method" title="#start (instance method)">- (Object) <strong>start</strong> </a>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'><p>
|
221
|
+
Starts the Websocket server and listen the new clients to broadcast the
|
222
|
+
messages.
|
223
|
+
</p>
|
224
|
+
</div></span>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
|
229
|
+
</ul>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Logging (module)">Logging</a></span></h3>
|
242
|
+
<p class="inherited"><span class='object_link'><a href="Logging.html#logger-instance_method" title="Logging#logger (method)">#logger</a></span>, <span class='object_link'><a href="Logging.html#logger-class_method" title="Logging.logger (method)">logger</a></span></p>
|
243
|
+
<div id="constructor_details" class="method_details_list">
|
244
|
+
<h2>Constructor Details</h2>
|
245
|
+
|
246
|
+
<div class="method_details first">
|
247
|
+
<h3 class="signature first" id="initialize-instance_method">
|
248
|
+
|
249
|
+
- (<tt><span class='object_link'><a href="" title="WebSocketServer (class)">WebSocketServer</a></span></tt>) <strong>initialize</strong>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</h3><div class="docstring">
|
256
|
+
<div class="discussion">
|
257
|
+
<p>
|
258
|
+
Configures the WebSocket to works in test mode (path controversia)
|
259
|
+
</p>
|
260
|
+
|
261
|
+
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
<div class="tags">
|
265
|
+
|
266
|
+
|
267
|
+
</div><table class="source_code">
|
268
|
+
<tr>
|
269
|
+
<td>
|
270
|
+
<pre class="lines">
|
271
|
+
|
272
|
+
|
273
|
+
18
|
274
|
+
19
|
275
|
+
20
|
276
|
+
21
|
277
|
+
22</pre>
|
278
|
+
</td>
|
279
|
+
<td>
|
280
|
+
<pre class="code"><span class="info file"># File 'lib/helper/websocket_server.rb', line 18</span>
|
281
|
+
|
282
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
283
|
+
|
284
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Starting WebSocketServer...</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
285
|
+
|
286
|
+
<span class='kw'>end</span></pre>
|
287
|
+
</td>
|
288
|
+
</tr>
|
289
|
+
</table>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
<div id="instance_method_details" class="method_details_list">
|
296
|
+
<h2>Instance Method Details</h2>
|
297
|
+
|
298
|
+
|
299
|
+
<div class="method_details first">
|
300
|
+
<h3 class="signature first" id="start-instance_method">
|
301
|
+
|
302
|
+
- (<tt>Object</tt>) <strong>start</strong>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
</h3><div class="docstring">
|
309
|
+
<div class="discussion">
|
310
|
+
<p>
|
311
|
+
Starts the Websocket server and listen the new clients to broadcast the
|
312
|
+
messages
|
313
|
+
</p>
|
314
|
+
|
315
|
+
|
316
|
+
</div>
|
317
|
+
</div>
|
318
|
+
<div class="tags">
|
319
|
+
|
320
|
+
|
321
|
+
</div><table class="source_code">
|
322
|
+
<tr>
|
323
|
+
<td>
|
324
|
+
<pre class="lines">
|
325
|
+
|
326
|
+
|
327
|
+
25
|
328
|
+
26
|
329
|
+
27
|
330
|
+
28
|
331
|
+
29
|
332
|
+
30
|
333
|
+
31
|
334
|
+
32
|
335
|
+
33
|
336
|
+
34
|
337
|
+
35
|
338
|
+
36
|
339
|
+
37
|
340
|
+
38
|
341
|
+
39
|
342
|
+
40
|
343
|
+
41
|
344
|
+
42
|
345
|
+
43
|
346
|
+
44
|
347
|
+
45
|
348
|
+
46
|
349
|
+
47
|
350
|
+
48
|
351
|
+
49
|
352
|
+
50
|
353
|
+
51
|
354
|
+
52
|
355
|
+
53
|
356
|
+
54
|
357
|
+
55
|
358
|
+
56
|
359
|
+
57
|
360
|
+
58
|
361
|
+
59
|
362
|
+
60
|
363
|
+
61
|
364
|
+
62
|
365
|
+
63
|
366
|
+
64</pre>
|
367
|
+
</td>
|
368
|
+
<td>
|
369
|
+
<pre class="code"><span class="info file"># File 'lib/helper/websocket_server.rb', line 25</span>
|
370
|
+
|
371
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span>
|
372
|
+
<span class='ivar'>@redis</span> <span class='op'>=</span> <span class='const'>Redis</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:host</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:port</span> <span class='op'>=></span> <span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
|
373
|
+
|
374
|
+
|
375
|
+
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
376
|
+
<span class='const'>EventMachine</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span> <span class='kw'>do</span>
|
377
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='op'>*</span><span class='int'>80</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Starting websockets server at ws://</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='rbrace'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='op'>*</span><span class='int'>80</span>
|
378
|
+
|
379
|
+
<span class='const'>EventMachine</span><span class='op'>::</span><span class='const'>WebSocket</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='symbol'>:host</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:port</span> <span class='op'>=></span> <span class='const'>Settings</span><span class='period'>.</span><span class='id identifier rubyid_websocket'>websocket</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ws'>ws</span><span class='op'>|</span>
|
380
|
+
<span class='id identifier rubyid_ws'>ws</span><span class='period'>.</span><span class='id identifier rubyid_onopen'>onopen</span> <span class='kw'>do</span>
|
381
|
+
|
382
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> : Client connected</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='op'>*</span><span class='int'>80</span>
|
383
|
+
<span class='const'>SOCKETS</span> <span class='op'><<</span> <span class='id identifier rubyid_ws'>ws</span>
|
384
|
+
<span class='kw'>end</span>
|
385
|
+
|
386
|
+
<span class='id identifier rubyid_ws'>ws</span><span class='period'>.</span><span class='id identifier rubyid_onclose'>onclose</span> <span class='kw'>do</span>
|
387
|
+
|
388
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%H:%M:%S</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> : Client disconnected</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='op'>*</span><span class='int'>80</span>
|
389
|
+
<span class='const'>SOCKETS</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_ws'>ws</span>
|
390
|
+
<span class='kw'>end</span>
|
391
|
+
<span class='kw'>end</span>
|
392
|
+
<span class='kw'>end</span>
|
393
|
+
<span class='kw'>end</span>
|
394
|
+
|
395
|
+
|
396
|
+
<span class='const'>Thread</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
|
397
|
+
<span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_subscribe'>subscribe</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ws</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_on'>on</span><span class='op'>|</span>
|
398
|
+
|
399
|
+
<span class='id identifier rubyid_on'>on</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_chan'>chan</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span><span class='op'>|</span>
|
400
|
+
|
401
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg'>msg</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
402
|
+
<span class='const'>SOCKETS</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='id identifier rubyid_msg'>msg</span><span class='rbrace'>}</span>
|
403
|
+
|
404
|
+
<span class='kw'>end</span>
|
405
|
+
<span class='kw'>end</span>
|
406
|
+
<span class='kw'>end</span>
|
407
|
+
|
408
|
+
<span class='id identifier rubyid_sleep'>sleep</span>
|
409
|
+
|
410
|
+
<span class='kw'>end</span></pre>
|
411
|
+
</td>
|
412
|
+
</tr>
|
413
|
+
</table>
|
414
|
+
</div>
|
415
|
+
|
416
|
+
</div>
|
417
|
+
|
418
|
+
</div>
|
419
|
+
|
420
|
+
<div id="footer">
|
421
|
+
Generated on Sat Aug 18 16:24:08 2012 by
|
422
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
423
|
+
0.8.2.1 (ruby-1.9.2).
|
424
|
+
</div>
|
425
|
+
|
426
|
+
</body>
|
427
|
+
</html>
|