Brendan Abolivier пре 9 година
родитељ
комит
0a2f2c3632
100 измењених фајлова са 9504 додато и 0 уклоњено
  1. 4
    0
      web/multi/server/node_modules/socket.io/.npmignore
  2. 16
    0
      web/multi/server/node_modules/socket.io/.travis.yml
  3. 491
    0
      web/multi/server/node_modules/socket.io/History.md
  4. 22
    0
      web/multi/server/node_modules/socket.io/LICENSE
  5. 15
    0
      web/multi/server/node_modules/socket.io/Makefile
  6. 374
    0
      web/multi/server/node_modules/socket.io/Readme.md
  7. 2
    0
      web/multi/server/node_modules/socket.io/index.js
  8. 247
    0
      web/multi/server/node_modules/socket.io/lib/client.js
  9. 379
    0
      web/multi/server/node_modules/socket.io/lib/index.js
  10. 242
    0
      web/multi/server/node_modules/socket.io/lib/namespace.js
  11. 449
    0
      web/multi/server/node_modules/socket.io/lib/socket.js
  12. 3
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/.jshintrc
  13. 6
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/.npmignore
  14. 157
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/History.md
  15. 33
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/Makefile
  16. 156
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/Readme.md
  17. 147
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/browser.js
  18. 19
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/component.json
  19. 197
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/debug.js
  20. 209
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/node.js
  21. 5
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/.npmignore
  22. 33
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/README.md
  23. 111
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/index.js
  24. 45
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/package.json
  25. 73
    0
      web/multi/server/node_modules/socket.io/node_modules/debug/package.json
  26. 6
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/.npmignore
  27. 7
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/.travis.yml
  28. 408
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/History.md
  29. 23
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/Makefile
  30. 517
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/README.md
  31. 4
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/index.js
  32. 126
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/engine.io.js
  33. 391
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/server.js
  34. 393
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/socket.js
  35. 114
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transport.js
  36. 36
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/index.js
  37. 108
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/polling-jsonp.js
  38. 101
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/polling-xhr.js
  39. 279
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/polling.js
  40. 110
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/websocket.js
  41. 3
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/.npmignore
  42. 18
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/README.md
  43. 103
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/lib/base64id.js
  44. 47
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/package.json
  45. 3
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/.jshintrc
  46. 6
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/.npmignore
  47. 132
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/History.md
  48. 33
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/Makefile
  49. 153
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/Readme.md
  50. 144
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/browser.js
  51. 19
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/component.json
  52. 197
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/debug.js
  53. 129
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node.js
  54. 5
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/.npmignore
  55. 33
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/README.md
  56. 111
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/index.js
  57. 45
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/package.json
  58. 71
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/package.json
  59. 17
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.npmignore
  60. 45
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.travis.yml
  61. 18
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.zuul.yml
  62. 100
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/History.md
  63. 22
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/LICENSE
  64. 26
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Makefile
  65. 202
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Readme.md
  66. 2
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/index.js
  67. 594
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/browser.js
  68. 467
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js
  69. 19
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/keys.js
  70. 2
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.npmignore
  71. 5
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.travis.yml
  72. 19
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/LICENCE
  73. 75
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/README.md
  74. 28
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/index.js
  75. 61
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/package.json
  76. 17
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/.npmignore
  77. 8
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/Makefile
  78. 17
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/README.md
  79. 29
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/index.js
  80. 39
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/package.json
  81. 1
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.npmignore
  82. 6
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.travis.yml
  83. 22
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/LICENSE-MIT
  84. 23
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md
  85. 39
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/grunt.js
  86. 59
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js
  87. 56
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json
  88. 2
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.npmignore
  89. 8
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.zuul.yml
  90. 14
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/Makefile
  91. 11
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/README.md
  92. 49
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/index.js
  93. 44
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/package.json
  94. 15
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/.npmignore
  95. 5
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/History.md
  96. 20
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/LICENSE
  97. 3
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/Makefile
  98. 4
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/README.md
  99. 1
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/fixtures/big.json
  100. 0
    0
      web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/index.js

+ 4
- 0
web/multi/server/node_modules/socket.io/.npmignore Прегледај датотеку

@@ -0,0 +1,4 @@
1
+support
2
+test
3
+examples
4
+.gitignore

+ 16
- 0
web/multi/server/node_modules/socket.io/.travis.yml Прегледај датотеку

@@ -0,0 +1,16 @@
1
+language: node_js
2
+node_js:
3
+  - "0.8"
4
+  - "0.10"
5
+  - "0.11"
6
+
7
+git:
8
+  depth: 1
9
+
10
+matrix:
11
+  fast_finish: true
12
+  allow_failures:
13
+    - node_js: "0.11"
14
+
15
+notifications:
16
+  irc: "irc.freenode.org#socket.io"

+ 491
- 0
web/multi/server/node_modules/socket.io/History.md Прегледај датотеку

@@ -0,0 +1,491 @@
1
+
2
+1.3.5 / 2015-03-03
3
+==================
4
+
5
+ * package: bump `socket.io-parser`
6
+
7
+1.3.4 / 2015-02-14
8
+==================
9
+
10
+ * package: bump `socket.io-client`
11
+
12
+1.3.3 / 2015-02-03
13
+==================
14
+
15
+ * socket: warn node_redis-style about missing `error`
16
+ * package: bump parser to better handle bad binary packets
17
+
18
+1.3.2 / 2015-01-19
19
+==================
20
+
21
+ * no change on this release
22
+
23
+1.3.1 / 2015-01-19
24
+==================
25
+
26
+ * no change on this release
27
+ * package: bump `engine.io`
28
+
29
+1.3.0 / 2015-01-19
30
+==================
31
+
32
+ * package: bump `engine.io`
33
+ * add test for reconnection after server restarts [rase-]
34
+ * update license with up-to-date year range [fay-jai]
35
+ * fix leaving unknown rooms [defunctzombie]
36
+ * allow null origins when allowed origins is a function [drewblaisdell]
37
+ * fix tests on node 0.11
38
+ * package: fix `npm test` to run on windows
39
+ * package: bump `debug` v2.1.0 [coderaiser]
40
+ * added tests for volatile [rase-]
41
+
42
+1.2.1 / 2014-11-21
43
+==================
44
+
45
+ * fix protocol violations and improve error handling (GH-1880)
46
+ * package: bump `engine.io` for websocket leak fix [3rd-Eden]
47
+ * style tweaks
48
+
49
+1.2.0 / 2014-10-27
50
+==================
51
+
52
+ * package: bump `engine.io`
53
+ * downloads badge
54
+ * add test to check that empty rooms are autopruned
55
+ * added Server#origins(v:Function) description for dynamic CORS
56
+ * added test coverage for Server#origins(function) for dynamic CORS
57
+ * added optional Server#origins(function) for dynamic CORS
58
+ * fix usage example for Server#close
59
+ * package: fix main file for example application 'chat'
60
+ * package: bump `socket.io-parser`
61
+ * update README http ctor to createServer()
62
+ * bump adapter with a lot of fixes for room bookkeeping
63
+
64
+1.1.0 / 2014-09-04
65
+==================
66
+
67
+ * examples: minor fix of escaping
68
+ * testing for equivalence of namespaces starting with / or without
69
+ * update index.js
70
+ * added relevant tests
71
+ * take "" and "/" as equivalent namespaces on server
72
+ * use svg instead of png to get better image quality in readme
73
+ * make CI build faster
74
+ * fix splice arguments and `socket.rooms` value update in `socket.leaveAll`.
75
+ * client cannot connect to non-existing namespaces
76
+ * bump engine.io version to get the cached IP address
77
+ * fixed handshake object address property and made the test case more strict.
78
+ * package: bump `engine.io`
79
+ * fixed the failing test where server crashes on disconnect involving connectBuffer
80
+ * npmignore: ignore `.gitignore` (fixes #1607)
81
+ * test: added failing case for `socket.disconnect` and nsps
82
+ * fix repo in package.json
83
+ * improve Close documentation
84
+ * use ephemeral ports
85
+ * fix: We should use the standard http protocol to handler the etag header.
86
+ * override default browser font-family for inputs
87
+ * update has-binary-data to 1.0.3
88
+ * add close specs
89
+ * add ability to stop the http server even if not created inside socket.io
90
+ * make sure server gets close
91
+ * Add test case for checking that reconnect_failed is fired only once upon failure
92
+ * package: bump `socket.io-parser` for `component-emitter` dep fix
93
+
94
+1.0.6 / 2014-06-19
95
+==================
96
+
97
+ * package: bump `socket.io-client`
98
+
99
+1.0.5 / 2014-06-16
100
+==================
101
+
102
+ * package: bump `engine.io` to fix jsonp `\n` bug and CORS warnings
103
+ * index: fix typo [yanatan16]
104
+ * add `removeListener` to blacklisted events
105
+ * examples: clearer instructions to install chat example
106
+ * index: fix namespace `connectBuffer` issue
107
+
108
+1.0.4 / 2014-06-02
109
+==================
110
+
111
+ * package: bump socket.io-client
112
+
113
+1.0.3 / 2014-05-31
114
+==================
115
+
116
+ * package: bump `socket.io-client`
117
+ * package: bump `socket.io-parser` for binary ACK fix
118
+ * package: bump `engine.io` for binary UTF8 fix
119
+ * example: fix XSS in chat example
120
+
121
+1.0.2 / 2014-05-28
122
+==================
123
+
124
+ * package: bump `socket.io-parser` for windows fix
125
+
126
+1.0.1 / 2014-05-28
127
+==================
128
+
129
+ * bump due to bad npm tag
130
+
131
+1.0.0 / 2014-05-28
132
+==================
133
+
134
+ * stable release
135
+
136
+1.0.0-pre5 / 2014-05-22
137
+=======================
138
+
139
+ * package: bump `socket.io-client` for parser fixes
140
+ * package: bump `engine.io`
141
+
142
+1.0.0-pre4 / 2014-05-19
143
+=======================
144
+
145
+ * package: bump client
146
+
147
+1.0.0-pre3 / 2014-05-17
148
+=======================
149
+
150
+ * package: bump parser
151
+ * package: bump engine.io
152
+
153
+1.0.0-pre2 / 2014-04-27
154
+=======================
155
+
156
+ * package: bump `engine.io`
157
+ * added backwards compatible of engine.io maxHttpBufferSize
158
+ * added test that server and client using same protocol
159
+ * added support for setting allowed origins
160
+ * added information about logging
161
+ * the set function in server can be used to set some attributes for BC
162
+ * fix error in callback call 'done' instead of 'next' in docs
163
+ * package: bump `socket.io-parser`
164
+ * package: bump `expect.js`
165
+ * added some new tests, including binary with acks
166
+
167
+1.0.0-pre / 2014-03-14
168
+======================
169
+
170
+ * implemented `engine.io`
171
+ * implemented `socket.io-adapter`
172
+ * implemented `socket.io-protocol`
173
+ * implemented `debug` and improved instrumentation
174
+ * added binary support
175
+ * added new `require('io')(srv)` signature
176
+ * simplified `socket.io-client` serving
177
+
178
+0.9.14 / 2013-03-29
179
+===================
180
+
181
+  * manager: fix memory leak with SSL [jpallen]
182
+
183
+0.9.13 / 2012-12-13
184
+===================
185
+
186
+  * package: fixed `base64id` requirement
187
+
188
+0.9.12 / 2012-12-13
189
+===================
190
+
191
+  * manager: fix for latest node which is returning a clone with `listeners` [viirya]
192
+
193
+0.9.11 / 2012-11-02
194
+===================
195
+
196
+  * package: move redis to optionalDependenices [3rd-Eden]
197
+  * bumped client
198
+
199
+0.9.10 / 2012-08-10
200
+===================
201
+
202
+  * Don't lowercase log messages
203
+  * Always set the HTTP response in case an error should be returned to the client
204
+  * Create or destroy the flash policy server on configuration change
205
+  * Honour configuration to disable flash policy server
206
+  * Add express 3.0 instructions on Readme.md
207
+  * Bump client
208
+
209
+0.9.9 / 2012-08-01
210
+==================
211
+
212
+  * Fixed sync disconnect xhrs handling
213
+  * Put license text in its own file (#965)
214
+  * Add warning to .listen() to ease the migration to Express 3.x
215
+  * Restored compatibility with node 0.4.x
216
+
217
+0.9.8 / 2012-07-24
218
+==================
219
+
220
+  * Bumped client.
221
+
222
+0.9.7 / 2012-07-24
223
+==================
224
+
225
+  * Prevent crash when socket leaves a room twice.
226
+  * Corrects unsafe usage of for..in
227
+  * Fix for node 0.8 with `gzip compression` [vadimi]
228
+  * Update redis to support Node 0.8.x
229
+  * Made ID generation securely random
230
+  * Fix Redis Store race condition in manager onOpen unsubscribe callback
231
+  * Fix for EventEmitters always reusing the same Array instance for listeners
232
+
233
+0.9.6 / 2012-04-17
234
+==================
235
+
236
+  * Fixed XSS in jsonp-polling.
237
+
238
+0.9.5 / 2012-04-05
239
+==================
240
+
241
+  * Added test for polling and socket close.
242
+  * Ensure close upon request close.
243
+  * Fix disconnection reason being lost for polling transports.
244
+  * Ensure that polling transports work with Connection: close.
245
+  * Log disconnection reason.
246
+
247
+0.9.4 / 2012-04-01
248
+==================
249
+
250
+  * Disconnecting from namespace improvement (#795) [DanielBaulig]
251
+  * Bumped client with polling reconnection loop (#438)
252
+
253
+0.9.3 / 2012-03-28
254
+==================
255
+
256
+  * Fix "Syntax error" on FF Web Console with XHR Polling [mikito]
257
+
258
+0.9.2 / 2012-03-13
259
+==================
260
+
261
+  * More sensible close `timeout default` (fixes disconnect issue)
262
+
263
+0.9.1-1 / 2012-03-02
264
+====================
265
+
266
+  * Bumped client with NPM dependency fix.
267
+
268
+0.9.1 / 2012-03-02
269
+==================
270
+
271
+  * Changed heartbeat timeout and interval defaults (60 and 25 seconds)
272
+  * Make tests work both on 0.4 and 0.6
273
+  * Updated client (improvements + bug fixes).
274
+
275
+0.9.0 / 2012-02-26
276
+==================
277
+
278
+  * Make it possible to use a regexp to match the socket.io resource URL.
279
+    We need this because we have to prefix the socket.io URL with a variable ID.
280
+  * Supplemental fix to gavinuhma/authfix, it looks like the same Access-Control-Origin logic is needed in the http and xhr-polling transports
281
+  * Updated express dep for windows compatibility.
282
+  * Combine two substr calls into one in decodePayload to improve performance
283
+  * Minor documentation fix
284
+  * Minor. Conform to style of other files.
285
+  * Switching setting to 'match origin protocol'
286
+  * Revert "Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect()."
287
+  * Revert "Handle leaked dispatch:[id] subscription."
288
+  * Merge pull request #667 from dshaw/patch/redis-disconnect
289
+  * Handle leaked dispatch:[id] subscription.
290
+  * Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect().
291
+  * Prevent memory leaking on uncompleted requests & add max post size limitation
292
+  * Fix for testcase
293
+  * Set Access-Control-Allow-Credentials true, regardless of cookie
294
+  * Remove assertvarnish from package as it breaks on 0.6
295
+  * Correct irc channel
296
+  * Added proper return after reserved field error
297
+  * Fixes manager.js failure to close connection after transport error has happened
298
+  * Added implicit port 80 for origin checks. fixes #638
299
+  * Fixed bug #432 in 0.8.7
300
+  * Set Access-Control-Allow-Origin header to origin to enable withCredentials
301
+  * Adding configuration variable matchOriginProtocol
302
+  * Fixes location mismatch error in Safari.
303
+  * Use tty to detect if we should add colors or not by default.
304
+  * Updated the package location.
305
+
306
+0.8.7 / 2011-11-05
307
+==================
308
+
309
+  * Fixed memory leaks in closed clients.
310
+  * Fixed memory leaks in namespaces.
311
+  * Fixed websocket handling for malformed requests from proxies. [einaros]
312
+  * Node 0.6 compatibility. [einaros] [3rd-Eden]
313
+  * Adapted tests and examples.
314
+
315
+0.8.6 / 2011-10-27 
316
+==================
317
+
318
+  * Added JSON decoding on jsonp-polling transport.
319
+  * Fixed README example.
320
+  * Major speed optimizations [3rd-Eden] [einaros] [visionmedia]
321
+  * Added decode/encode benchmarks [visionmedia]
322
+  * Added support for black-listing client sent events.
323
+  * Fixed logging options, closes #540 [3rd-Eden]
324
+  * Added vary header for gzip [3rd-Eden]
325
+  * Properly cleaned up async websocket / flashsocket tests, after patching node-websocket-client
326
+  * Patched to properly shut down when a finishClose call is made during connection establishment
327
+  * Added support for socket.io version on url and far-future Expires [3rd-Eden] [getify]
328
+  * Began IE10 compatibility [einaros] [tbranyen]
329
+  * Misc WebSocket fixes [einaros]
330
+  * Added UTF8 to respone headers for htmlfile [3rd-Eden]
331
+
332
+0.8.5 / 2011-10-07
333
+==================
334
+
335
+  * Added websocket draft HyBi-16 support. [einaros]
336
+  * Fixed websocket continuation bugs. [einaros]
337
+  * Fixed flashsocket transport name.
338
+  * Fixed websocket tests.
339
+  * Ensured `parser#decodePayload` doesn't choke.
340
+  * Added http referrer verification to manager verifyOrigin.
341
+  * Added access control for cross domain xhr handshakes [3rd-Eden]
342
+  * Added support for automatic generation of socket.io files [3rd-Eden]
343
+  * Added websocket binary support [einaros]
344
+  * Added gzip support for socket.io.js [3rd-Eden]
345
+  * Expose socket.transport [3rd-Eden]
346
+  * Updated client.
347
+
348
+0.8.4 / 2011-09-06
349
+==================
350
+
351
+  * Client build
352
+
353
+0.8.3 / 2011-09-03
354
+==================
355
+
356
+  * Fixed `\n` parsing for non-JSON packets (fixes #479).
357
+  * Fixed parsing of certain unicode characters (fixes #451).
358
+  * Fixed transport message packet logging.
359
+  * Fixed emission of `error` event resulting in an uncaught exception if unhandled (fixes #476).
360
+  * Fixed; allow for falsy values as the configuration value of `log level` (fixes #491).
361
+  * Fixed repository URI in `package.json`. Fixes #504.
362
+  * Added text/plain content-type to handshake responses [einaros]
363
+  * Improved single byte writes [einaros]
364
+  * Updated socket.io-flashsocket default port from 843 to 10843 [3rd-Eden]
365
+  * Updated client.
366
+
367
+0.8.2 / 2011-08-29
368
+==================
369
+
370
+  * Updated client.
371
+
372
+0.8.1 / 2011-08-29
373
+==================
374
+
375
+  * Fixed utf8 bug in send framing in websocket [einaros]
376
+  * Fixed typo in docs [Znarkus]
377
+  * Fixed bug in send framing for over 64kB of data in websocket [einaros]
378
+  * Corrected ping handling in websocket transport [einaros]
379
+
380
+0.8.0 / 2011-08-28
381
+==================
382
+
383
+  * Updated to work with two-level websocket versioning. [einaros]
384
+  * Added hybi07 support. [einaros]
385
+  * Added hybi10 support. [einaros]
386
+  * Added http referrer verification to manager.js verifyOrigin. [einaors]
387
+
388
+0.7.11 / 2011-08-27
389
+===================
390
+
391
+  * Updated socket.io-client.
392
+
393
+0.7.10 / 2011-08-27
394
+===================
395
+
396
+  * Updated socket.io-client.
397
+
398
+0.7.9 / 2011-08-12
399
+==================
400
+
401
+  * Updated socket.io-client.
402
+  * Make sure we only do garbage collection when the server we receive is actually run.
403
+
404
+0.7.8 / 2011-08-08
405
+==================
406
+
407
+  * Changed; make sure sio#listen passes options to both HTTP server and socket.io manager.
408
+  * Added docs for sio#listen.
409
+  * Added options parameter support for Manager constructor.
410
+  * Added memory leaks tests and test-leaks Makefile task.
411
+  * Removed auto npm-linking from make test.
412
+  * Make sure that you can disable heartbeats. [3rd-Eden]
413
+  * Fixed rooms memory leak [3rd-Eden]
414
+  * Send response once we got all POST data, not immediately [Pita]
415
+  * Fixed onLeave behavior with missing clientsk [3rd-Eden]
416
+  * Prevent duplicate references in rooms.
417
+  * Added alias for `to` to `in` and `in` to `to`.
418
+  * Fixed roomClients definition.
419
+  * Removed dependency on redis for installation without npm [3rd-Eden]
420
+  * Expose path and querystring in handshakeData [3rd-Eden]
421
+
422
+0.7.7 / 2011-07-12
423
+==================
424
+
425
+  * Fixed double dispatch handling with emit to closed clients.
426
+  * Added test for emitting to closed clients to prevent regression.
427
+  * Fixed race condition in redis test.
428
+  * Changed Transport#end instrumentation.
429
+  * Leveraged $emit instead of emit internally.
430
+  * Made tests faster.
431
+  * Fixed double disconnect events.
432
+  * Fixed disconnect logic
433
+  * Simplified remote events handling in Socket.
434
+  * Increased testcase timeout.
435
+  * Fixed unknown room emitting (GH-291). [3rd-Eden]
436
+  * Fixed `address` in handshakeData. [3rd-Eden]
437
+  * Removed transports definition in chat example.
438
+  * Fixed room cleanup
439
+  * Fixed; make sure the client is cleaned up after booting.
440
+  * Make sure to mark the client as non-open if the connection is closed.
441
+  * Removed unneeded `buffer` declarations.
442
+  * Fixed; make sure to clear socket handlers and subscriptions upon transport close.
443
+
444
+0.7.6 / 2011-06-30
445
+==================
446
+
447
+  * Fixed general dispatching when a client has closed.
448
+
449
+0.7.5 / 2011-06-30
450
+==================
451
+
452
+  * Fixed dispatching to clients that are disconnected.
453
+
454
+0.7.4 / 2011-06-30
455
+==================
456
+
457
+  * Fixed; only clear handlers if they were set. [level09]
458
+
459
+0.7.3 / 2011-06-30
460
+==================
461
+
462
+  * Exposed handshake data to clients.
463
+  * Refactored dispatcher interface.
464
+  * Changed; Moved id generation method into the manager.
465
+  * Added sub-namespace authorization. [3rd-Eden]
466
+  * Changed; normalized SocketNamespace local eventing [dvv]
467
+  * Changed; Use packet.reason or default to 'packet' [3rd-Eden]
468
+  * Changed console.error to console.log.
469
+  * Fixed; bind both servers at the same time do that the test never times out.
470
+  * Added 304 support.
471
+  * Removed `Transport#name` for abstract interface.
472
+  * Changed; lazily require http and https module only when needed. [3rd-Eden]
473
+
474
+0.7.2 / 2011-06-22
475
+==================
476
+
477
+  * Make sure to write a packet (of type `noop`) when closing a poll.
478
+    This solves a problem with cross-domain requests being flagged as aborted and
479
+    reconnection being triggered.
480
+  * Added `noop` message type.
481
+
482
+0.7.1 / 2011-06-21 
483
+==================
484
+
485
+  * Fixed cross-domain XHR.
486
+  * Added CORS test to xhr-polling suite.
487
+
488
+0.7.0 / 2010-06-21
489
+==================
490
+
491
+  * http://socket.io/announcement.html

+ 22
- 0
web/multi/server/node_modules/socket.io/LICENSE Прегледај датотеку

@@ -0,0 +1,22 @@
1
+(The MIT License)
2
+
3
+Copyright (c) 2014-2015 Automattic <dev@cloudup.com>
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining
6
+a copy of this software and associated documentation files (the
7
+'Software'), to deal in the Software without restriction, including
8
+without limitation the rights to use, copy, modify, merge, publish,
9
+distribute, sublicense, and/or sell copies of the Software, and to
10
+permit persons to whom the Software is furnished to do so, subject to
11
+the following conditions:
12
+
13
+The above copyright notice and this permission notice shall be
14
+included in all copies or substantial portions of the Software.
15
+
16
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 15
- 0
web/multi/server/node_modules/socket.io/Makefile Прегледај датотеку

@@ -0,0 +1,15 @@
1
+
2
+REPORTER = dot
3
+
4
+test:
5
+	@./node_modules/.bin/mocha \
6
+		--reporter $(REPORTER) \
7
+		--slow 200ms \
8
+		--bail
9
+
10
+test-cov:
11
+	@./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \
12
+		--reporter $(REPORTER) \
13
+		test/
14
+
15
+.PHONY: test

+ 374
- 0
web/multi/server/node_modules/socket.io/Readme.md Прегледај датотеку

@@ -0,0 +1,374 @@
1
+
2
+# socket.io
3
+
4
+[![Build Status](https://secure.travis-ci.org/Automattic/socket.io.svg)](http://travis-ci.org/Automattic/socket.io)
5
+![NPM version](https://badge.fury.io/js/socket.io.svg)
6
+![Downloads](http://img.shields.io/npm/dm/socket.io.svg?style=flat)
7
+
8
+## How to use
9
+
10
+The following example attaches socket.io to a plain Node.JS
11
+HTTP server listening on port `3000`.
12
+
13
+```js
14
+var server = require('http').createServer();
15
+var io = require('socket.io')(server);
16
+io.on('connection', function(socket){
17
+  socket.on('event', function(data){});
18
+  socket.on('disconnect', function(){});
19
+});
20
+server.listen(3000);
21
+```
22
+
23
+### Standalone
24
+
25
+```js
26
+var io = require('socket.io')();
27
+io.on('connection', function(socket){});
28
+io.listen(3000);
29
+```
30
+
31
+### In conjunction with Express
32
+
33
+Starting with **3.0**, express applications have become request handler
34
+functions that you pass to `http` or `http` `Server` instances. You need
35
+to pass the `Server` to `socket.io`, and not the express application
36
+function.
37
+
38
+```js
39
+var app = require('express')();
40
+var server = require('http').createServer(app);
41
+var io = require('socket.io')(server);
42
+io.on('connection', function(){ /* … */ });
43
+server.listen(3000);
44
+```
45
+
46
+### In conjunction with Koa
47
+
48
+Like Express.JS, Koa works by exposing an application as a request
49
+handler function, but only by calling the `callback` method.
50
+
51
+```js
52
+var app = require('koa')();
53
+var server = require('http').createServer(app.callback());
54
+var io = require('socket.io')(server);
55
+io.on('connection', function(){ /* … */ });
56
+server.listen(3000);
57
+```
58
+
59
+## API
60
+
61
+### Server
62
+
63
+  Exposed by `require('socket.io')`.
64
+
65
+### Server()
66
+
67
+  Creates a new `Server`. Works with and without `new`:
68
+
69
+  ```js
70
+  var io = require('socket.io')();
71
+  // or
72
+  var Server = require('socket.io');
73
+  var io = new Server();
74
+  ```
75
+
76
+### Server(opts:Object)
77
+
78
+  Optionally, the first or second argument (see below) of the `Server`
79
+  constructor can be an options object.
80
+
81
+  The following options are supported:
82
+
83
+  - `serveClient` sets the value for Server#serveClient()
84
+  - `path` sets the value for Server#path()
85
+
86
+  The same options passed to socket.io are always passed to
87
+  the `engine.io` `Server` that gets created. See engine.io
88
+  [options](https://github.com/learnboost/engine.io#methods-1)
89
+  as reference.
90
+
91
+### Server(srv:http#Server, opts:Object)
92
+
93
+  Creates a new `Server` and attaches it to the given `srv`. Optionally
94
+  `opts` can be passed.
95
+
96
+### Server(port:Number, opts:Object)
97
+
98
+  Binds socket.io to a new `http.Server` that listens on `port`.
99
+
100
+### Server#serveClient(v:Boolean):Server
101
+
102
+  If `v` is `true` the attached server (see `Server#attach`) will serve
103
+  the client files. Defaults to `true`.
104
+
105
+  This method has no effect after `attach` is called.
106
+
107
+  ```js
108
+  // pass a server and the `serveClient` option
109
+  var io = require('socket.io')(http, { serveClient: false });
110
+
111
+  // or pass no server and then you can call the method
112
+  var io = require('socket.io')();
113
+  io.serveClient(false);
114
+  io.attach(http);
115
+  ```
116
+
117
+  If no arguments are supplied this method returns the current value.
118
+
119
+### Server#path(v:String):Server
120
+
121
+  Sets the path `v` under which `engine.io` and the static files will be
122
+  served. Defaults to `/socket.io`.
123
+
124
+  If no arguments are supplied this method returns the current value.
125
+
126
+### Server#adapter(v:Adapter):Server
127
+
128
+  Sets the adapter `v`. Defaults to an instance of the `Adapter` that
129
+  ships with socket.io which is memory based. See
130
+  [socket.io-adapter](https://github.com/Automattic/socket.io-adapter).
131
+
132
+  If no arguments are supplied this method returns the current value.
133
+
134
+### Server#origins(v:String):Server
135
+
136
+  Sets the allowed origins `v`. Defaults to any origins being allowed.
137
+
138
+  If no arguments are supplied this method returns the current value.
139
+
140
+### Server#origins(v:Function):Server
141
+
142
+  Sets the allowed origins as dynamic function. Function takes two arguments `origin:String` and `callback(error, success)`, where `success` is a boolean value indicating whether origin is allowed or not.
143
+
144
+  __Potential drawbacks__:
145
+  * in some situations, when it is not possible to determine `origin` it may have value of `*`
146
+  * As this function will be executed for every request, it is advised to make this function work as fast as possible
147
+  * If `socket.io` is used together with `Express`, the CORS headers will be affected only for `socket.io` requests. For Express can use [cors](https://github.com/troygoode/node-cors/)
148
+
149
+
150
+### Server#sockets:Namespace
151
+
152
+  The default (`/`) namespace.
153
+
154
+### Server#attach(srv:http#Server, opts:Object):Server
155
+
156
+  Attaches the `Server` to an engine.io instance on `srv` with the
157
+  supplied `opts` (optionally).
158
+
159
+### Server#attach(port:Number, opts:Object):Server
160
+
161
+  Attaches the `Server` to an engine.io instance that is bound to `port`
162
+  with the given `opts` (optionally).
163
+
164
+### Server#listen
165
+
166
+  Synonym of `Server#attach`.
167
+
168
+### Server#bind(srv:engine#Server):Server
169
+
170
+  Advanced use only. Binds the server to a specific engine.io `Server`
171
+  (or compatible API) instance.
172
+
173
+### Server#onconnection(socket:engine#Socket):Server
174
+
175
+  Advanced use only. Creates a new `socket.io` client from the incoming
176
+  engine.io (or compatible API) `socket`.
177
+
178
+### Server#of(nsp:String):Namespace
179
+
180
+  Initializes and retrieves the given `Namespace` by its pathname
181
+  identifier `nsp`.
182
+
183
+  If the namespace was already initialized it returns it right away.
184
+
185
+### Server#emit
186
+
187
+  Emits an event to all connected clients. The following two are
188
+  equivalent:
189
+
190
+  ```js
191
+  var io = require('socket.io')();
192
+  io.sockets.emit('an event sent to all connected clients');
193
+  io.emit('an event sent to all connected clients');
194
+  ```
195
+
196
+  For other available methods, see `Namespace` below.
197
+
198
+### Server#close
199
+
200
+  Closes socket server
201
+
202
+  ```js
203
+  var Server = require('socket.io');
204
+  var PORT   = 3030;
205
+  var server = require('http').Server();
206
+
207
+  var io = Server(PORT);
208
+
209
+  io.close(); // Close current server
210
+
211
+  server.listen(PORT); // PORT is free to use
212
+
213
+  io = Server(server);
214
+  ```
215
+
216
+### Server#use
217
+
218
+  See `Namespace#use` below.
219
+
220
+### Namespace
221
+
222
+  Represents a pool of sockets connected under a given scope identified
223
+  by a pathname (eg: `/chat`).
224
+
225
+  By default the client always connects to `/`.
226
+
227
+#### Events
228
+
229
+  - `connection` / `connect`. Fired upon a connection.
230
+
231
+    Parameters:
232
+    - `Socket` the incoming socket.
233
+
234
+### Namespace#name:String
235
+
236
+  The namespace identifier property.
237
+
238
+### Namespace#connected:Object<Socket>
239
+
240
+  Hash of `Socket` objects that are connected to this namespace indexed
241
+  by `id`.
242
+
243
+### Namespace#use(fn:Function):Namespace
244
+
245
+  Registers a middleware, which is a function that gets executed for
246
+  every incoming `Socket` and receives as parameter the socket and a
247
+  function to optionally defer execution to the next registered
248
+  middleware.
249
+
250
+  ```js
251
+  var io = require('socket.io')();
252
+  io.use(function(socket, next){
253
+    if (socket.request.headers.cookie) return next();
254
+    next(new Error('Authentication error'));
255
+  });
256
+  ```
257
+
258
+  Errors passed to middleware callbacks are sent as special `error`
259
+  packets to clients.
260
+
261
+### Socket
262
+
263
+  A `Socket` is the fundamental class for interacting with browser
264
+  clients. A `Socket` belongs to a certain `Namespace` (by default `/`)
265
+  and uses an underlying `Client` to communicate.
266
+
267
+### Socket#rooms:Array
268
+
269
+  A list of strings identifying the rooms this socket is in.
270
+
271
+### Socket#client:Client
272
+
273
+  A reference to the underlying `Client` object.
274
+
275
+### Socket#conn:Socket
276
+
277
+  A reference to the underlying `Client` transport connection (engine.io
278
+  `Socket` object).
279
+
280
+### Socket#request:Request
281
+
282
+  A getter proxy that returns the reference to the `request` that
283
+  originated the underlying engine.io `Client`. Useful for accessing
284
+  request headers such as `Cookie` or `User-Agent`.
285
+
286
+### Socket#id:String
287
+
288
+  A unique identifier for the socket session, that comes from the
289
+  underlying `Client`.
290
+
291
+### Socket#emit(name:String[, …]):Socket
292
+
293
+  Emits an event to the socket identified by the string `name`. Any
294
+  other parameters can be included.
295
+
296
+  All datastructures are supported, including `Buffer`. JavaScript
297
+  functions can't be serialized/deserialized.
298
+
299
+  ```js
300
+  var io = require('socket.io')();
301
+  io.on('connection', function(socket){
302
+    socket.emit('an event', { some: 'data' });
303
+  });
304
+  ```
305
+
306
+### Socket#join(name:String[, fn:Function]):Socket
307
+
308
+  Adds the socket to the `room`, and fires optionally a callback `fn`
309
+  with `err` signature (if any).
310
+
311
+  The socket is automatically a member of a room identified with its
312
+  session id (see `Socket#id`).
313
+
314
+  The mechanics of joining  rooms are handled by the `Adapter`
315
+  that has been configured (see `Server#adapter` above), defaulting to
316
+  [socket.io-adapter](https://github.com/Automattic/socket.io-adapter).
317
+
318
+### Socket#leave(name:String[, fn:Function]):Socket
319
+
320
+  Removes the socket from `room`, and fires optionally a callback `fn`
321
+  with `err` signature (if any).
322
+
323
+  **Rooms are left automatically upon disconnection**.
324
+
325
+  The mechanics of leaving rooms are handled by the `Adapter`
326
+  that has been configured (see `Server#adapter` above), defaulting to
327
+  [socket.io-adapter](https://github.com/Automattic/socket.io-adapter).
328
+
329
+### Socket#to(room:String):Socket
330
+### Socket#in(room:String):Socket
331
+
332
+  Sets a modifier for a subsequent event emission that the event will
333
+  only be _broadcasted_ to sockets that have joined the given `room`.
334
+
335
+  To emit to multiple rooms, you can call `to` several times.
336
+
337
+  ```js
338
+  var io = require('socket.io')();
339
+  io.on('connection', function(socket){
340
+    socket.to('others').emit('an event', { some: 'data' });
341
+  });
342
+  ```
343
+
344
+### Client
345
+
346
+  The `Client` class represents an incoming transport (engine.io)
347
+  connection. A `Client` can be associated with many multiplexed `Socket`
348
+  that belong to different `Namespace`s.
349
+
350
+### Client#conn
351
+
352
+  A reference to the underlying `engine.io` `Socket` connection.
353
+
354
+### Client#request
355
+
356
+  A getter proxy that returns the reference to the `request` that
357
+  originated the engine.io connection. Useful for accessing
358
+  request headers such as `Cookie` or `User-Agent`.
359
+
360
+## Debug / logging
361
+
362
+Socket.IO is powered by [debug](http://github.com/visionmedia/debug).
363
+In order to see all the debug output, run your app with the environment variable
364
+`DEBUG` including the desired scope.
365
+
366
+To see the output from all of Socket.IO's debugging scopes you can use:
367
+
368
+```
369
+DEBUG=socket.io* node myapp
370
+```
371
+
372
+## License
373
+
374
+MIT

+ 2
- 0
web/multi/server/node_modules/socket.io/index.js Прегледај датотеку

@@ -0,0 +1,2 @@
1
+
2
+module.exports = require('./lib');

+ 247
- 0
web/multi/server/node_modules/socket.io/lib/client.js Прегледај датотеку

@@ -0,0 +1,247 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var parser = require('socket.io-parser');
7
+var debug = require('debug')('socket.io:client');
8
+
9
+/**
10
+ * Module exports.
11
+ */
12
+
13
+module.exports = Client;
14
+
15
+/**
16
+ * Client constructor.
17
+ *
18
+ * @param {Server} server instance
19
+ * @param {Socket} connection
20
+ * @api private
21
+ */
22
+
23
+function Client(server, conn){
24
+  this.server = server;
25
+  this.conn = conn;
26
+  this.encoder = new parser.Encoder();
27
+  this.decoder = new parser.Decoder();
28
+  this.id = conn.id;
29
+  this.request = conn.request;
30
+  this.setup();
31
+  this.sockets = [];
32
+  this.nsps = {};
33
+  this.connectBuffer = [];
34
+}
35
+
36
+/**
37
+ * Sets up event listeners.
38
+ *
39
+ * @api private
40
+ */
41
+
42
+Client.prototype.setup = function(){
43
+  this.onclose = this.onclose.bind(this);
44
+  this.ondata = this.ondata.bind(this);
45
+  this.onerror = this.onerror.bind(this);
46
+  this.ondecoded = this.ondecoded.bind(this);
47
+
48
+  this.decoder.on('decoded', this.ondecoded);
49
+  this.conn.on('data', this.ondata);
50
+  this.conn.on('error', this.onerror);
51
+  this.conn.on('close', this.onclose);
52
+};
53
+
54
+/**
55
+ * Connects a client to a namespace.
56
+ *
57
+ * @param {String} namespace name
58
+ * @api private
59
+ */
60
+
61
+Client.prototype.connect = function(name){
62
+  debug('connecting to namespace %s', name);
63
+  if (!this.server.nsps[name]) {
64
+    this.packet({ type: parser.ERROR, nsp: name, data : 'Invalid namespace'});
65
+    return;
66
+  }
67
+  var nsp = this.server.of(name);
68
+  if ('/' != name && !this.nsps['/']) {
69
+    this.connectBuffer.push(name);
70
+    return;
71
+  }
72
+
73
+  var self = this;
74
+  var socket = nsp.add(this, function(){
75
+    self.sockets.push(socket);
76
+    self.nsps[nsp.name] = socket;
77
+
78
+    if ('/' == nsp.name && self.connectBuffer.length > 0) {
79
+      self.connectBuffer.forEach(self.connect, self);
80
+      self.connectBuffer = [];
81
+    }
82
+  });
83
+};
84
+
85
+/**
86
+ * Disconnects from all namespaces and closes transport.
87
+ *
88
+ * @api private
89
+ */
90
+
91
+Client.prototype.disconnect = function(){
92
+  var socket;
93
+  // we don't use a for loop because the length of
94
+  // `sockets` changes upon each iteration
95
+  while (socket = this.sockets.shift()) {
96
+    socket.disconnect();
97
+  }
98
+  this.close();
99
+};
100
+
101
+/**
102
+ * Removes a socket. Called by each `Socket`.
103
+ *
104
+ * @api private
105
+ */
106
+
107
+Client.prototype.remove = function(socket){
108
+  var i = this.sockets.indexOf(socket);
109
+  if (~i) {
110
+    var nsp = this.sockets[i].nsp.name;
111
+    this.sockets.splice(i, 1);
112
+    delete this.nsps[nsp];
113
+  } else {
114
+    debug('ignoring remove for %s', socket.id);
115
+  }
116
+};
117
+
118
+/**
119
+ * Closes the underlying connection.
120
+ *
121
+ * @api private
122
+ */
123
+
124
+Client.prototype.close = function(){
125
+  if ('open' == this.conn.readyState) {
126
+    debug('forcing transport close');
127
+    this.conn.close();
128
+    this.onclose('forced server close');
129
+  }
130
+};
131
+
132
+/**
133
+ * Writes a packet to the transport.
134
+ *
135
+ * @param {Object} packet object
136
+ * @param {Boolean} whether packet is already encoded
137
+ * @param {Boolean} whether packet is volatile
138
+ * @api private
139
+ */
140
+
141
+Client.prototype.packet = function(packet, preEncoded, volatile){
142
+  var self = this;
143
+
144
+  // this writes to the actual connection
145
+  function writeToEngine(encodedPackets) {
146
+    if (volatile && !self.conn.transport.writable) return;
147
+    for (var i = 0; i < encodedPackets.length; i++) {
148
+      self.conn.write(encodedPackets[i]);
149
+    }
150
+  }
151
+
152
+  if ('open' == this.conn.readyState) {
153
+    debug('writing packet %j', packet);
154
+    if(!preEncoded) { // not broadcasting, need to encode
155
+      this.encoder.encode(packet, function (encodedPackets) { // encode, then write results to engine
156
+        writeToEngine(encodedPackets);
157
+      });
158
+    } else { // a broadcast pre-encodes a packet
159
+      writeToEngine(packet);
160
+    }
161
+  } else {
162
+    debug('ignoring packet write %j', packet);
163
+  }
164
+};
165
+
166
+/**
167
+ * Called with incoming transport data.
168
+ *
169
+ * @api private
170
+ */
171
+
172
+Client.prototype.ondata = function(data){
173
+  // try/catch is needed for protocol violations (GH-1880)
174
+  try {
175
+    this.decoder.add(data);
176
+  } catch(e) {
177
+    this.onerror(e);
178
+  }
179
+};
180
+
181
+/**
182
+ * Called when parser fully decodes a packet.
183
+ *
184
+ * @api private
185
+ */
186
+
187
+Client.prototype.ondecoded = function(packet) {
188
+  if (parser.CONNECT == packet.type) {
189
+    this.connect(packet.nsp);
190
+  } else {
191
+    var socket = this.nsps[packet.nsp];
192
+    if (socket) {
193
+      socket.onpacket(packet);
194
+    } else {
195
+      debug('no socket for namespace %s', packet.nsp);
196
+    }
197
+  }
198
+};
199
+
200
+/**
201
+ * Handles an error.
202
+ *
203
+ * @param {Objcet} error object
204
+ * @api private
205
+ */
206
+
207
+Client.prototype.onerror = function(err){
208
+  this.sockets.forEach(function(socket){
209
+    socket.onerror(err);
210
+  });
211
+  this.onclose('client error');
212
+};
213
+
214
+/**
215
+ * Called upon transport close.
216
+ *
217
+ * @param {String} reason
218
+ * @api private
219
+ */
220
+
221
+Client.prototype.onclose = function(reason){
222
+  debug('client close with reason %s', reason);
223
+
224
+  // ignore a potential subsequent `close` event
225
+  this.destroy();
226
+
227
+  // `nsps` and `sockets` are cleaned up seamlessly
228
+  var socket;
229
+  while (socket = this.sockets.shift()) {
230
+    socket.onclose(reason);
231
+  }
232
+
233
+  this.decoder.destroy(); // clean up decoder
234
+};
235
+
236
+/**
237
+ * Cleans up event listeners.
238
+ *
239
+ * @api private
240
+ */
241
+
242
+Client.prototype.destroy = function(){
243
+  this.conn.removeListener('data', this.ondata);
244
+  this.conn.removeListener('error', this.onerror);
245
+  this.conn.removeListener('close', this.onclose);
246
+  this.decoder.removeListener('decoded', this.ondecoded);
247
+};

+ 379
- 0
web/multi/server/node_modules/socket.io/lib/index.js Прегледај датотеку

@@ -0,0 +1,379 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var http = require('http');
7
+var read = require('fs').readFileSync;
8
+var parse = require('url').parse;
9
+var engine = require('engine.io');
10
+var client = require('socket.io-client');
11
+var clientVersion = require('socket.io-client/package').version;
12
+var Client = require('./client');
13
+var Namespace = require('./namespace');
14
+var Adapter = require('socket.io-adapter');
15
+var debug = require('debug')('socket.io:server');
16
+var url = require('url');
17
+
18
+/**
19
+ * Module exports.
20
+ */
21
+
22
+module.exports = Server;
23
+
24
+/**
25
+ * Socket.IO client source.
26
+ */
27
+
28
+var clientSource = read(require.resolve('socket.io-client/socket.io.js'), 'utf-8');
29
+
30
+/**
31
+ * Server constructor.
32
+ *
33
+ * @param {http.Server|Number|Object} http server, port or options
34
+ * @param {Object} options
35
+ * @api public
36
+ */
37
+
38
+function Server(srv, opts){
39
+  if (!(this instanceof Server)) return new Server(srv, opts);
40
+  if ('object' == typeof srv && !srv.listen) {
41
+    opts = srv;
42
+    srv = null;
43
+  }
44
+  opts = opts || {};
45
+  this.nsps = {};
46
+  this.path(opts.path || '/socket.io');
47
+  this.serveClient(false !== opts.serveClient);
48
+  this.adapter(opts.adapter || Adapter);
49
+  this.origins(opts.origins || '*:*');
50
+  this.sockets = this.of('/');
51
+  if (srv) this.attach(srv, opts);
52
+}
53
+
54
+/**
55
+ * Server request verification function, that checks for allowed origins
56
+ *
57
+ * @param {http.IncomingMessage} request
58
+ * @param {Function} callback to be called with the result: `fn(err, success)`
59
+ */
60
+
61
+Server.prototype.checkRequest = function(req, fn) {
62
+  var origin = req.headers.origin || req.headers.referer;
63
+
64
+  // file:// URLs produce a null Origin which can't be authorized via echo-back
65
+  if ('null' == origin || null == origin) origin = '*';
66
+
67
+  if (!!origin && typeof(this._origins) == 'function') return this._origins(origin, fn);
68
+  if (this._origins.indexOf('*:*') !== -1) return fn(null, true);
69
+  if (origin) {
70
+    try {
71
+      var parts = url.parse(origin);
72
+      parts.port = parts.port || 80;
73
+      var ok =
74
+        ~this._origins.indexOf(parts.hostname + ':' + parts.port) ||
75
+        ~this._origins.indexOf(parts.hostname + ':*') ||
76
+        ~this._origins.indexOf('*:' + parts.port);
77
+      return fn(null, !!ok);
78
+    } catch (ex) {
79
+    }
80
+  }
81
+  fn(null, false);
82
+};
83
+
84
+/**
85
+ * Sets/gets whether client code is being served.
86
+ *
87
+ * @param {Boolean} whether to serve client code
88
+ * @return {Server|Boolean} self when setting or value when getting
89
+ * @api public
90
+ */
91
+
92
+Server.prototype.serveClient = function(v){
93
+  if (!arguments.length) return this._serveClient;
94
+  this._serveClient = v;
95
+  return this;
96
+};
97
+
98
+/**
99
+ * Old settings for backwards compatibility
100
+ */
101
+
102
+var oldSettings = {
103
+  "transports": "transports",
104
+  "heartbeat timeout": "pingTimeout",
105
+  "heartbeat interval": "pingInterval",
106
+  "destroy buffer size": "maxHttpBufferSize"
107
+};
108
+
109
+/**
110
+ * Backwards compatiblity.
111
+ *
112
+ * @api public
113
+ */
114
+
115
+Server.prototype.set = function(key, val){
116
+  if ('authorization' == key && val) {
117
+    this.use(function(socket, next) {
118
+      val(socket.request, function(err, authorized) {
119
+        if (err) return next(new Error(err));
120
+        if (!authorized) return next(new Error('Not authorized'));
121
+        next();
122
+      });
123
+    });
124
+  } else if ('origins' == key && val) {
125
+    this.origins(val);
126
+  } else if ('resource' == key) {
127
+    this.path(val);
128
+  } else if (oldSettings[key] && this.eio[oldSettings[key]]) {
129
+    this.eio[oldSettings[key]] = val;
130
+  } else {
131
+    console.error('Option %s is not valid. Please refer to the README.', key);
132
+  }
133
+
134
+  return this;
135
+};
136
+
137
+/**
138
+ * Sets the client serving path.
139
+ *
140
+ * @param {String} pathname
141
+ * @return {Server|String} self when setting or value when getting
142
+ * @api public
143
+ */
144
+
145
+Server.prototype.path = function(v){
146
+  if (!arguments.length) return this._path;
147
+  this._path = v.replace(/\/$/, '');
148
+  return this;
149
+};
150
+
151
+/**
152
+ * Sets the adapter for rooms.
153
+ *
154
+ * @param {Adapter} pathname
155
+ * @return {Server|Adapter} self when setting or value when getting
156
+ * @api public
157
+ */
158
+
159
+Server.prototype.adapter = function(v){
160
+  if (!arguments.length) return this._adapter;
161
+  this._adapter = v;
162
+  for (var i in this.nsps) {
163
+    if (this.nsps.hasOwnProperty(i)) {
164
+      this.nsps[i].initAdapter();
165
+    }
166
+  }
167
+  return this;
168
+};
169
+
170
+/**
171
+ * Sets the allowed origins for requests.
172
+ *
173
+ * @param {String} origins
174
+ * @return {Server|Adapter} self when setting or value when getting
175
+ * @api public
176
+ */
177
+
178
+Server.prototype.origins = function(v){
179
+  if (!arguments.length) return this._origins;
180
+
181
+  this._origins = v;
182
+  return this;
183
+};
184
+
185
+/**
186
+ * Attaches socket.io to a server or port.
187
+ *
188
+ * @param {http.Server|Number} server or port
189
+ * @param {Object} options passed to engine.io
190
+ * @return {Server} self
191
+ * @api public
192
+ */
193
+
194
+Server.prototype.listen =
195
+Server.prototype.attach = function(srv, opts){
196
+  if ('function' == typeof srv) {
197
+    var msg = 'You are trying to attach socket.io to an express ' +
198
+    'request handler function. Please pass a http.Server instance.';
199
+    throw new Error(msg);
200
+  }
201
+
202
+  // handle a port as a string
203
+  if (Number(srv) == srv) {
204
+    srv = Number(srv);
205
+  }
206
+
207
+  if ('number' == typeof srv) {
208
+    debug('creating http server and binding to %d', srv);
209
+    var port = srv;
210
+    srv = http.Server(function(req, res){
211
+      res.writeHead(404);
212
+      res.end();
213
+    });
214
+    srv.listen(port);
215
+
216
+  }
217
+
218
+  // set engine.io path to `/socket.io`
219
+  opts = opts || {};
220
+  opts.path = opts.path || this.path();
221
+  // set origins verification
222
+  opts.allowRequest = this.checkRequest.bind(this);
223
+
224
+  // initialize engine
225
+  debug('creating engine.io instance with opts %j', opts);
226
+  this.eio = engine.attach(srv, opts);
227
+
228
+  // attach static file serving
229
+  if (this._serveClient) this.attachServe(srv);
230
+
231
+  // Export http server
232
+  this.httpServer = srv;
233
+
234
+  // bind to engine events
235
+  this.bind(this.eio);
236
+
237
+  return this;
238
+};
239
+
240
+/**
241
+ * Attaches the static file serving.
242
+ *
243
+ * @param {Function|http.Server} http server
244
+ * @api private
245
+ */
246
+
247
+Server.prototype.attachServe = function(srv){
248
+  debug('attaching client serving req handler');
249
+  var url = this._path + '/socket.io.js';
250
+  var evs = srv.listeners('request').slice(0);
251
+  var self = this;
252
+  srv.removeAllListeners('request');
253
+  srv.on('request', function(req, res) {
254
+    if (0 == req.url.indexOf(url)) {
255
+      self.serve(req, res);
256
+    } else {
257
+      for (var i = 0; i < evs.length; i++) {
258
+        evs[i].call(srv, req, res);
259
+      }
260
+    }
261
+  });
262
+};
263
+
264
+/**
265
+ * Handles a request serving `/socket.io.js`
266
+ *
267
+ * @param {http.Request} req
268
+ * @param {http.Response} res
269
+ * @api private
270
+ */
271
+
272
+Server.prototype.serve = function(req, res){
273
+  var etag = req.headers['if-none-match'];
274
+  if (etag) {
275
+    if (clientVersion == etag) {
276
+      debug('serve client 304');
277
+      res.writeHead(304);
278
+      res.end();
279
+      return;
280
+    }
281
+  }
282
+
283
+  debug('serve client source');
284
+  res.setHeader('Content-Type', 'application/javascript');
285
+  res.setHeader('ETag', clientVersion);
286
+  res.writeHead(200);
287
+  res.end(clientSource);
288
+};
289
+
290
+/**
291
+ * Binds socket.io to an engine.io instance.
292
+ *
293
+ * @param {engine.Server} engine.io (or compatible) server
294
+ * @return {Server} self
295
+ * @api public
296
+ */
297
+
298
+Server.prototype.bind = function(engine){
299
+  this.engine = engine;
300
+  this.engine.on('connection', this.onconnection.bind(this));
301
+  return this;
302
+};
303
+
304
+/**
305
+ * Called with each incoming transport connection.
306
+ *
307
+ * @param {engine.Socket} socket
308
+ * @return {Server} self
309
+ * @api public
310
+ */
311
+
312
+Server.prototype.onconnection = function(conn){
313
+  debug('incoming connection with id %s', conn.id);
314
+  var client = new Client(this, conn);
315
+  client.connect('/');
316
+  return this;
317
+};
318
+
319
+/**
320
+ * Looks up a namespace.
321
+ *
322
+ * @param {String} nsp name
323
+ * @param {Function} optional, nsp `connection` ev handler
324
+ * @api public
325
+ */
326
+
327
+Server.prototype.of = function(name, fn){
328
+  if (String(name)[0] !== '/') name = '/' + name;
329
+  
330
+  if (!this.nsps[name]) {
331
+    debug('initializing namespace %s', name);
332
+    var nsp = new Namespace(this, name);
333
+    this.nsps[name] = nsp;
334
+  }
335
+  if (fn) this.nsps[name].on('connect', fn);
336
+  return this.nsps[name];
337
+};
338
+
339
+/**
340
+ * Closes server connection
341
+ *
342
+ * @api public
343
+ */
344
+
345
+Server.prototype.close = function(){
346
+  this.nsps['/'].sockets.forEach(function(socket){
347
+    socket.onclose();
348
+  });
349
+
350
+  this.engine.close();
351
+
352
+  if(this.httpServer){
353
+    this.httpServer.close();
354
+  }
355
+};
356
+
357
+/**
358
+ * Expose main namespace (/).
359
+ */
360
+
361
+['on', 'to', 'in', 'use', 'emit', 'send', 'write'].forEach(function(fn){
362
+  Server.prototype[fn] = function(){
363
+    var nsp = this.sockets[fn];
364
+    return nsp.apply(this.sockets, arguments);
365
+  };
366
+});
367
+
368
+Namespace.flags.forEach(function(flag){
369
+  Server.prototype.__defineGetter__(flag, function(name){
370
+    this.flags.push(name);
371
+    return this;
372
+  });
373
+});
374
+
375
+/**
376
+ * BC with `io.listen`
377
+ */
378
+
379
+Server.listen = Server;

+ 242
- 0
web/multi/server/node_modules/socket.io/lib/namespace.js Прегледај датотеку

@@ -0,0 +1,242 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var Socket = require('./socket');
7
+var Emitter = require('events').EventEmitter;
8
+var parser = require('socket.io-parser');
9
+var debug = require('debug')('socket.io:namespace');
10
+var hasBin = require('has-binary-data');
11
+
12
+/**
13
+ * Module exports.
14
+ */
15
+
16
+module.exports = exports = Namespace;
17
+
18
+/**
19
+ * Blacklisted events.
20
+ */
21
+
22
+exports.events = [
23
+  'connect',    // for symmetry with client
24
+  'connection',
25
+  'newListener'
26
+];
27
+
28
+/**
29
+ * Flags.
30
+ */
31
+
32
+exports.flags = ['json'];
33
+
34
+/**
35
+ * `EventEmitter#emit` reference.
36
+ */
37
+
38
+var emit = Emitter.prototype.emit;
39
+
40
+/**
41
+ * Namespace constructor.
42
+ *
43
+ * @param {Server} server instance
44
+ * @param {Socket} name
45
+ * @api private
46
+ */
47
+
48
+function Namespace(server, name){
49
+  this.name = name;
50
+  this.server = server;
51
+  this.sockets = [];
52
+  this.connected = {};
53
+  this.fns = [];
54
+  this.ids = 0;
55
+  this.acks = {};
56
+  this.initAdapter();
57
+}
58
+
59
+/**
60
+ * Inherits from `EventEmitter`.
61
+ */
62
+
63
+Namespace.prototype.__proto__ = Emitter.prototype;
64
+
65
+/**
66
+ * Apply flags from `Socket`.
67
+ */
68
+
69
+exports.flags.forEach(function(flag){
70
+  Namespace.prototype.__defineGetter__(flag, function(){
71
+    this.flags = this.flags || {};
72
+    this.flags[flag] = true;
73
+    return this;
74
+  });
75
+});
76
+
77
+/**
78
+ * Initializes the `Adapter` for this nsp.
79
+ * Run upon changing adapter by `Server#adapter`
80
+ * in addition to the constructor.
81
+ *
82
+ * @api private
83
+ */
84
+
85
+Namespace.prototype.initAdapter = function(){
86
+  this.adapter = new (this.server.adapter())(this);
87
+};
88
+
89
+/**
90
+ * Sets up namespace middleware.
91
+ *
92
+ * @return {Namespace} self
93
+ * @api public
94
+ */
95
+
96
+Namespace.prototype.use = function(fn){
97
+  this.fns.push(fn);
98
+  return this;
99
+};
100
+
101
+/**
102
+ * Executes the middleware for an incoming client.
103
+ *
104
+ * @param {Socket} socket that will get added
105
+ * @param {Function} last fn call in the middleware
106
+ * @api private
107
+ */
108
+
109
+Namespace.prototype.run = function(socket, fn){
110
+  var fns = this.fns.slice(0);
111
+  if (!fns.length) return fn(null);
112
+
113
+  function run(i){
114
+    fns[i](socket, function(err){
115
+      // upon error, short-circuit
116
+      if (err) return fn(err);
117
+
118
+      // if no middleware left, summon callback
119
+      if (!fns[i + 1]) return fn(null);
120
+
121
+      // go on to next
122
+      run(i + 1);
123
+    });
124
+  }
125
+
126
+  run(0);
127
+};
128
+
129
+/**
130
+ * Targets a room when emitting.
131
+ *
132
+ * @param {String} name
133
+ * @return {Namespace} self
134
+ * @api public
135
+ */
136
+
137
+Namespace.prototype.to =
138
+Namespace.prototype['in'] = function(name){
139
+  this.rooms = this.rooms || [];
140
+  if (!~this.rooms.indexOf(name)) this.rooms.push(name);
141
+  return this;
142
+};
143
+
144
+/**
145
+ * Adds a new client.
146
+ *
147
+ * @return {Socket}
148
+ * @api private
149
+ */
150
+
151
+Namespace.prototype.add = function(client, fn){
152
+  debug('adding socket to nsp %s', this.name);
153
+  var socket = new Socket(this, client);
154
+  var self = this;
155
+  this.run(socket, function(err){
156
+    process.nextTick(function(){
157
+      if ('open' == client.conn.readyState) {
158
+        if (err) return socket.error(err.data || err.message);
159
+
160
+        // track socket
161
+        self.sockets.push(socket);
162
+
163
+        // it's paramount that the internal `onconnect` logic
164
+        // fires before user-set events to prevent state order
165
+        // violations (such as a disconnection before the connection
166
+        // logic is complete)
167
+        socket.onconnect();
168
+        if (fn) fn();
169
+
170
+        // fire user-set events
171
+        self.emit('connect', socket);
172
+        self.emit('connection', socket);
173
+      } else {
174
+        debug('next called after client was closed - ignoring socket');
175
+      }
176
+    });
177
+  });
178
+  return socket;
179
+};
180
+
181
+/**
182
+ * Removes a client. Called by each `Socket`.
183
+ *
184
+ * @api private
185
+ */
186
+
187
+Namespace.prototype.remove = function(socket){
188
+  var i = this.sockets.indexOf(socket);
189
+  if (~i) {
190
+    this.sockets.splice(i, 1);
191
+  } else {
192
+    debug('ignoring remove for %s', socket.id);
193
+  }
194
+};
195
+
196
+/**
197
+ * Emits to all clients.
198
+ *
199
+ * @return {Namespace} self
200
+ * @api public
201
+ */
202
+
203
+Namespace.prototype.emit = function(ev){
204
+  if (~exports.events.indexOf(ev)) {
205
+    emit.apply(this, arguments);
206
+  } else {
207
+    // set up packet object
208
+    var args = Array.prototype.slice.call(arguments);
209
+    var parserType = parser.EVENT; // default
210
+    if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary
211
+
212
+    var packet = { type: parserType, data: args };
213
+
214
+    if ('function' == typeof args[args.length - 1]) {
215
+      throw new Error('Callbacks are not supported when broadcasting');
216
+    }
217
+
218
+    this.adapter.broadcast(packet, {
219
+      rooms: this.rooms,
220
+      flags: this.flags
221
+    });
222
+
223
+    delete this.rooms;
224
+    delete this.flags;
225
+  }
226
+  return this;
227
+};
228
+
229
+/**
230
+ * Sends a `message` event to all clients.
231
+ *
232
+ * @return {Namespace} self
233
+ * @api public
234
+ */
235
+
236
+Namespace.prototype.send =
237
+Namespace.prototype.write = function(){
238
+  var args = Array.prototype.slice.call(arguments);
239
+  args.unshift('message');
240
+  this.emit.apply(this, args);
241
+  return this;
242
+};

+ 449
- 0
web/multi/server/node_modules/socket.io/lib/socket.js Прегледај датотеку

@@ -0,0 +1,449 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var Emitter = require('events').EventEmitter;
7
+var parser = require('socket.io-parser');
8
+var url = require('url');
9
+var debug = require('debug')('socket.io:socket');
10
+var hasBin = require('has-binary-data');
11
+
12
+/**
13
+ * Module exports.
14
+ */
15
+
16
+module.exports = exports = Socket;
17
+
18
+/**
19
+ * Blacklisted events.
20
+ *
21
+ * @api public
22
+ */
23
+
24
+exports.events = [
25
+  'error',
26
+  'connect',
27
+  'disconnect',
28
+  'newListener',
29
+  'removeListener'
30
+];
31
+
32
+/**
33
+ * Flags.
34
+ *
35
+ * @api private
36
+ */
37
+
38
+var flags = [
39
+  'json',
40
+  'volatile',
41
+  'broadcast'
42
+];
43
+
44
+/**
45
+ * `EventEmitter#emit` reference.
46
+ */
47
+
48
+var emit = Emitter.prototype.emit;
49
+
50
+/**
51
+ * Interface to a `Client` for a given `Namespace`.
52
+ *
53
+ * @param {Namespace} nsp
54
+ * @param {Client} client
55
+ * @api public
56
+ */
57
+
58
+function Socket(nsp, client){
59
+  this.nsp = nsp;
60
+  this.server = nsp.server;
61
+  this.adapter = this.nsp.adapter;
62
+  this.id = client.id;
63
+  this.request = client.request;
64
+  this.client = client;
65
+  this.conn = client.conn;
66
+  this.rooms = [];
67
+  this.acks = {};
68
+  this.connected = true;
69
+  this.disconnected = false;
70
+  this.handshake = this.buildHandshake();
71
+}
72
+
73
+/**
74
+ * Inherits from `EventEmitter`.
75
+ */
76
+
77
+Socket.prototype.__proto__ = Emitter.prototype;
78
+
79
+/**
80
+ * Apply flags from `Socket`.
81
+ */
82
+
83
+flags.forEach(function(flag){
84
+  Socket.prototype.__defineGetter__(flag, function(){
85
+    this.flags = this.flags || {};
86
+    this.flags[flag] = true;
87
+    return this;
88
+  });
89
+});
90
+
91
+/**
92
+ * `request` engine.io shorcut.
93
+ *
94
+ * @api public
95
+ */
96
+
97
+Socket.prototype.__defineGetter__('request', function(){
98
+  return this.conn.request;
99
+});
100
+
101
+/**
102
+ * Builds the `handshake` BC object
103
+ *
104
+ * @api private
105
+ */
106
+
107
+Socket.prototype.buildHandshake = function(){
108
+  return {
109
+    headers: this.request.headers,
110
+    time: (new Date) + '',
111
+    address: this.conn.remoteAddress,
112
+    xdomain: !!this.request.headers.origin,
113
+    secure: !!this.request.connection.encrypted,
114
+    issued: +(new Date),
115
+    url: this.request.url,
116
+    query: url.parse(this.request.url, true).query || {}
117
+  };
118
+};
119
+
120
+/**
121
+ * Emits to this client.
122
+ *
123
+ * @return {Socket} self
124
+ * @api public
125
+ */
126
+
127
+Socket.prototype.emit = function(ev){
128
+  if (~exports.events.indexOf(ev)) {
129
+    emit.apply(this, arguments);
130
+  } else {
131
+    var args = Array.prototype.slice.call(arguments);
132
+    var packet = {};
133
+    packet.type = hasBin(args) ? parser.BINARY_EVENT : parser.EVENT;
134
+    packet.data = args;
135
+
136
+    // access last argument to see if it's an ACK callback
137
+    if ('function' == typeof args[args.length - 1]) {
138
+      if (this._rooms || (this.flags && this.flags.broadcast)) {
139
+        throw new Error('Callbacks are not supported when broadcasting');
140
+      }
141
+
142
+      debug('emitting packet with ack id %d', this.nsp.ids);
143
+      this.acks[this.nsp.ids] = args.pop();
144
+      packet.id = this.nsp.ids++;
145
+    }
146
+
147
+    if (this._rooms || (this.flags && this.flags.broadcast)) {
148
+      this.adapter.broadcast(packet, {
149
+        except: [this.id],
150
+        rooms: this._rooms,
151
+        flags: this.flags
152
+      });
153
+    } else {
154
+      // dispatch packet
155
+      this.packet(packet);
156
+    }
157
+
158
+    // reset flags
159
+    delete this._rooms;
160
+    delete this.flags;
161
+  }
162
+  return this;
163
+};
164
+
165
+/**
166
+ * Targets a room when broadcasting.
167
+ *
168
+ * @param {String} name
169
+ * @return {Socket} self
170
+ * @api public
171
+ */
172
+
173
+Socket.prototype.to =
174
+Socket.prototype.in = function(name){
175
+  this._rooms = this._rooms || [];
176
+  if (!~this._rooms.indexOf(name)) this._rooms.push(name);
177
+  return this;
178
+};
179
+
180
+/**
181
+ * Sends a `message` event.
182
+ *
183
+ * @return {Socket} self
184
+ * @api public
185
+ */
186
+
187
+Socket.prototype.send =
188
+Socket.prototype.write = function(){
189
+  var args = Array.prototype.slice.call(arguments);
190
+  args.unshift('message');
191
+  this.emit.apply(this, args);
192
+  return this;
193
+};
194
+
195
+/**
196
+ * Writes a packet.
197
+ *
198
+ * @param {Object} packet object
199
+ * @api private
200
+ */
201
+
202
+Socket.prototype.packet = function(packet, preEncoded){
203
+  packet.nsp = this.nsp.name;
204
+  var volatile = this.flags && this.flags.volatile;
205
+  this.client.packet(packet, preEncoded, volatile);
206
+};
207
+
208
+/**
209
+ * Joins a room.
210
+ *
211
+ * @param {String} room
212
+ * @param {Function} optional, callback
213
+ * @return {Socket} self
214
+ * @api private
215
+ */
216
+
217
+Socket.prototype.join = function(room, fn){
218
+  debug('joining room %s', room);
219
+  var self = this;
220
+  if (~this.rooms.indexOf(room)) return this;
221
+  this.adapter.add(this.id, room, function(err){
222
+    if (err) return fn && fn(err);
223
+    debug('joined room %s', room);
224
+    self.rooms.push(room);
225
+    fn && fn(null);
226
+  });
227
+  return this;
228
+};
229
+
230
+/**
231
+ * Leaves a room.
232
+ *
233
+ * @param {String} room
234
+ * @param {Function} optional, callback
235
+ * @return {Socket} self
236
+ * @api private
237
+ */
238
+
239
+Socket.prototype.leave = function(room, fn){
240
+  debug('leave room %s', room);
241
+  var self = this;
242
+  this.adapter.del(this.id, room, function(err){
243
+    if (err) return fn && fn(err);
244
+    debug('left room %s', room);
245
+    var idx = self.rooms.indexOf(room);
246
+    if (idx >= 0) {
247
+      self.rooms.splice(idx, 1);
248
+    }
249
+    fn && fn(null);
250
+  });
251
+  return this;
252
+};
253
+
254
+/**
255
+ * Leave all rooms.
256
+ *
257
+ * @api private
258
+ */
259
+
260
+Socket.prototype.leaveAll = function(){
261
+  this.adapter.delAll(this.id);
262
+  this.rooms = [];
263
+};
264
+
265
+/**
266
+ * Called by `Namespace` upon succesful
267
+ * middleware execution (ie: authorization).
268
+ *
269
+ * @api private
270
+ */
271
+
272
+Socket.prototype.onconnect = function(){
273
+  debug('socket connected - writing packet');
274
+  this.join(this.id);
275
+  this.packet({ type: parser.CONNECT });
276
+  this.nsp.connected[this.id] = this;
277
+};
278
+
279
+/**
280
+ * Called with each packet. Called by `Client`.
281
+ *
282
+ * @param {Object} packet
283
+ * @api private
284
+ */
285
+
286
+Socket.prototype.onpacket = function(packet){
287
+  debug('got packet %j', packet);
288
+  switch (packet.type) {
289
+    case parser.EVENT:
290
+      this.onevent(packet);
291
+      break;
292
+
293
+    case parser.BINARY_EVENT:
294
+      this.onevent(packet);
295
+      break;
296
+
297
+    case parser.ACK:
298
+      this.onack(packet);
299
+      break;
300
+
301
+    case parser.BINARY_ACK:
302
+      this.onack(packet);
303
+      break;
304
+
305
+    case parser.DISCONNECT:
306
+      this.ondisconnect();
307
+      break;
308
+
309
+    case parser.ERROR:
310
+      this.emit('error', packet.data);
311
+  }
312
+};
313
+
314
+/**
315
+ * Called upon event packet.
316
+ *
317
+ * @param {Object} packet object
318
+ * @api private
319
+ */
320
+
321
+Socket.prototype.onevent = function(packet){
322
+  var args = packet.data || [];
323
+  debug('emitting event %j', args);
324
+
325
+  if (null != packet.id) {
326
+    debug('attaching ack callback to event');
327
+    args.push(this.ack(packet.id));
328
+  }
329
+
330
+  emit.apply(this, args);
331
+};
332
+
333
+/**
334
+ * Produces an ack callback to emit with an event.
335
+ *
336
+ * @param {Number} packet id
337
+ * @api private
338
+ */
339
+
340
+Socket.prototype.ack = function(id){
341
+  var self = this;
342
+  var sent = false;
343
+  return function(){
344
+    // prevent double callbacks
345
+    if (sent) return;
346
+    var args = Array.prototype.slice.call(arguments);
347
+    debug('sending ack %j', args);
348
+
349
+    var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK;
350
+    self.packet({
351
+      id: id,
352
+      type: type,
353
+      data: args
354
+    });
355
+  };
356
+};
357
+
358
+/**
359
+ * Called upon ack packet.
360
+ *
361
+ * @api private
362
+ */
363
+
364
+Socket.prototype.onack = function(packet){
365
+  var ack = this.acks[packet.id];
366
+  if ('function' == typeof ack) {
367
+    debug('calling ack %s with %j', packet.id, packet.data);
368
+    ack.apply(this, packet.data);
369
+    delete this.acks[packet.id];
370
+  } else {
371
+    debug('bad ack %s', packet.id);
372
+  }
373
+};
374
+
375
+/**
376
+ * Called upon client disconnect packet.
377
+ *
378
+ * @api private
379
+ */
380
+
381
+Socket.prototype.ondisconnect = function(){
382
+  debug('got disconnect packet');
383
+  this.onclose('client namespace disconnect');
384
+};
385
+
386
+/**
387
+ * Handles a client error.
388
+ *
389
+ * @api private
390
+ */
391
+
392
+Socket.prototype.onerror = function(err){
393
+  if (this.listeners('error').length) {
394
+    this.emit('error', err);
395
+  } else {
396
+    console.error('Missing error handler on `socket`.');
397
+    console.error(err.stack);
398
+  }
399
+};
400
+
401
+/**
402
+ * Called upon closing. Called by `Client`.
403
+ *
404
+ * @param {String} reason
405
+ * @param {Error} optional error object
406
+ * @api private
407
+ */
408
+
409
+Socket.prototype.onclose = function(reason){
410
+  if (!this.connected) return this;
411
+  debug('closing socket - reason %s', reason);
412
+  this.leaveAll();
413
+  this.nsp.remove(this);
414
+  this.client.remove(this);
415
+  this.connected = false;
416
+  this.disconnected = true;
417
+  delete this.nsp.connected[this.id];
418
+  this.emit('disconnect', reason);
419
+};
420
+
421
+/**
422
+ * Produces an `error` packet.
423
+ *
424
+ * @param {Object} error object
425
+ * @api private
426
+ */
427
+
428
+Socket.prototype.error = function(err){
429
+  this.packet({ type: parser.ERROR, data: err });
430
+};
431
+
432
+/**
433
+ * Disconnects this client.
434
+ *
435
+ * @param {Boolean} if `true`, closes the underlying connection
436
+ * @return {Socket} self
437
+ * @api public
438
+ */
439
+
440
+Socket.prototype.disconnect = function(close){
441
+  if (!this.connected) return this;
442
+  if (close) {
443
+    this.client.disconnect();
444
+  } else {
445
+    this.packet({ type: parser.DISCONNECT });
446
+    this.onclose('server namespace disconnect');
447
+  }
448
+  return this;
449
+};

+ 3
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/.jshintrc Прегледај датотеку

@@ -0,0 +1,3 @@
1
+{
2
+  "laxbreak": true
3
+}

+ 6
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/.npmignore Прегледај датотеку

@@ -0,0 +1,6 @@
1
+support
2
+test
3
+examples
4
+example
5
+*.sock
6
+dist

+ 157
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/History.md Прегледај датотеку

@@ -0,0 +1,157 @@
1
+
2
+2.1.0 / 2014-10-15
3
+==================
4
+
5
+ * node: implement `DEBUG_FD` env variable support
6
+ * package: update "browserify" to v6.1.0
7
+ * package: add "license" field to package.json (#135, @panuhorsmalahti)
8
+
9
+2.0.0 / 2014-09-01
10
+==================
11
+
12
+ * package: update "browserify" to v5.11.0
13
+ * node: use stderr rather than stdout for logging (#29, @stephenmathieson)
14
+
15
+1.0.4 / 2014-07-15
16
+==================
17
+
18
+ * dist: recompile
19
+ * example: remove `console.info()` log usage
20
+ * example: add "Content-Type" UTF-8 header to browser example
21
+ * browser: place %c marker after the space character
22
+ * browser: reset the "content" color via `color: inherit`
23
+ * browser: add colors support for Firefox >= v31
24
+ * debug: prefer an instance `log()` function over the global one (#119)
25
+ * Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
26
+
27
+1.0.3 / 2014-07-09
28
+==================
29
+
30
+ * Add support for multiple wildcards in namespaces (#122, @seegno)
31
+ * browser: fix lint
32
+
33
+1.0.2 / 2014-06-10
34
+==================
35
+
36
+  * browser: update color palette (#113, @gscottolson)
37
+  * common: make console logging function configurable (#108, @timoxley)
38
+  * node: fix %o colors on old node <= 0.8.x
39
+  * Makefile: find node path using shell/which (#109, @timoxley)
40
+
41
+1.0.1 / 2014-06-06
42
+==================
43
+
44
+  * browser: use `removeItem()` to clear localStorage
45
+  * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
46
+  * package: add "contributors" section
47
+  * node: fix comment typo
48
+  * README: list authors
49
+
50
+1.0.0 / 2014-06-04
51
+==================
52
+
53
+  * make ms diff be global, not be scope
54
+  * debug: ignore empty strings in enable()
55
+  * node: make DEBUG_COLORS able to disable coloring
56
+  * *: export the `colors` array
57
+  * npmignore: don't publish the `dist` dir
58
+  * Makefile: refactor to use browserify
59
+  * package: add "browserify" as a dev dependency
60
+  * Readme: add Web Inspector Colors section
61
+  * node: reset terminal color for the debug content
62
+  * node: map "%o" to `util.inspect()`
63
+  * browser: map "%j" to `JSON.stringify()`
64
+  * debug: add custom "formatters"
65
+  * debug: use "ms" module for humanizing the diff
66
+  * Readme: add "bash" syntax highlighting
67
+  * browser: add Firebug color support
68
+  * browser: add colors for WebKit browsers
69
+  * node: apply log to `console`
70
+  * rewrite: abstract common logic for Node & browsers
71
+  * add .jshintrc file
72
+
73
+0.8.1 / 2014-04-14
74
+==================
75
+
76
+  * package: re-add the "component" section
77
+
78
+0.8.0 / 2014-03-30
79
+==================
80
+
81
+  * add `enable()` method for nodejs. Closes #27
82
+  * change from stderr to stdout
83
+  * remove unnecessary index.js file
84
+
85
+0.7.4 / 2013-11-13
86
+==================
87
+
88
+  * remove "browserify" key from package.json (fixes something in browserify)
89
+
90
+0.7.3 / 2013-10-30
91
+==================
92
+
93
+  * fix: catch localStorage security error when cookies are blocked (Chrome)
94
+  * add debug(err) support. Closes #46
95
+  * add .browser prop to package.json. Closes #42
96
+
97
+0.7.2 / 2013-02-06
98
+==================
99
+
100
+  * fix package.json
101
+  * fix: Mobile Safari (private mode) is broken with debug
102
+  * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
103
+
104
+0.7.1 / 2013-02-05
105
+==================
106
+
107
+  * add repository URL to package.json
108
+  * add DEBUG_COLORED to force colored output
109
+  * add browserify support
110
+  * fix component. Closes #24
111
+
112
+0.7.0 / 2012-05-04
113
+==================
114
+
115
+  * Added .component to package.json
116
+  * Added debug.component.js build
117
+
118
+0.6.0 / 2012-03-16
119
+==================
120
+
121
+  * Added support for "-" prefix in DEBUG [Vinay Pulim]
122
+  * Added `.enabled` flag to the node version [TooTallNate]
123
+
124
+0.5.0 / 2012-02-02
125
+==================
126
+
127
+  * Added: humanize diffs. Closes #8
128
+  * Added `debug.disable()` to the CS variant
129
+  * Removed padding. Closes #10
130
+  * Fixed: persist client-side variant again. Closes #9
131
+
132
+0.4.0 / 2012-02-01
133
+==================
134
+
135
+  * Added browser variant support for older browsers [TooTallNate]
136
+  * Added `debug.enable('project:*')` to browser variant [TooTallNate]
137
+  * Added padding to diff (moved it to the right)
138
+
139
+0.3.0 / 2012-01-26
140
+==================
141
+
142
+  * Added millisecond diff when isatty, otherwise UTC string
143
+
144
+0.2.0 / 2012-01-22
145
+==================
146
+
147
+  * Added wildcard support
148
+
149
+0.1.0 / 2011-12-02
150
+==================
151
+
152
+  * Added: remove colors unless stderr isatty [TooTallNate]
153
+
154
+0.0.1 / 2010-01-03
155
+==================
156
+
157
+  * Initial release

+ 33
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/Makefile Прегледај датотеку

@@ -0,0 +1,33 @@
1
+
2
+# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
3
+THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
4
+THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
5
+
6
+# BIN directory
7
+BIN := $(THIS_DIR)/node_modules/.bin
8
+
9
+# applications
10
+NODE ?= $(shell which node)
11
+NPM ?= $(NODE) $(shell which npm)
12
+BROWSERIFY ?= $(NODE) $(BIN)/browserify
13
+
14
+all: dist/debug.js
15
+
16
+install: node_modules
17
+
18
+clean:
19
+	@rm -rf node_modules dist
20
+
21
+dist:
22
+	@mkdir -p $@
23
+
24
+dist/debug.js: node_modules browser.js debug.js dist
25
+	@$(BROWSERIFY) \
26
+		--standalone debug \
27
+		. > $@
28
+
29
+node_modules: package.json
30
+	@NODE_ENV= $(NPM) install
31
+	@touch node_modules
32
+
33
+.PHONY: all install clean

+ 156
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/Readme.md Прегледај датотеку

@@ -0,0 +1,156 @@
1
+# debug
2
+
3
+  tiny node.js debugging utility modelled after node core's debugging technique.
4
+
5
+## Installation
6
+
7
+```bash
8
+$ npm install debug
9
+```
10
+
11
+## Usage
12
+
13
+ With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
14
+
15
+Example _app.js_:
16
+
17
+```js
18
+var debug = require('debug')('http')
19
+  , http = require('http')
20
+  , name = 'My App';
21
+
22
+// fake app
23
+
24
+debug('booting %s', name);
25
+
26
+http.createServer(function(req, res){
27
+  debug(req.method + ' ' + req.url);
28
+  res.end('hello\n');
29
+}).listen(3000, function(){
30
+  debug('listening');
31
+});
32
+
33
+// fake worker of some kind
34
+
35
+require('./worker');
36
+```
37
+
38
+Example _worker.js_:
39
+
40
+```js
41
+var debug = require('debug')('worker');
42
+
43
+setInterval(function(){
44
+  debug('doing some work');
45
+}, 1000);
46
+```
47
+
48
+ The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
49
+
50
+  ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
51
+
52
+  ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
53
+
54
+## Millisecond diff
55
+
56
+  When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
57
+
58
+  ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
59
+
60
+  When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
61
+
62
+  ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
63
+
64
+## Conventions
65
+
66
+ If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
67
+
68
+## Wildcards
69
+
70
+  The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
71
+
72
+  You can also exclude specific debuggers by prefixing them with a "-" character.  For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
73
+
74
+## Browser support
75
+
76
+  Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
77
+
78
+```js
79
+a = debug('worker:a');
80
+b = debug('worker:b');
81
+
82
+setInterval(function(){
83
+  a('doing some work');
84
+}, 1000);
85
+
86
+setInterval(function(){
87
+  b('doing some work');
88
+}, 1200);
89
+```
90
+
91
+#### Web Inspector Colors
92
+
93
+  Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
94
+  option. These are WebKit web inspectors, Firefox ([since version
95
+  31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
96
+  and the Firebug plugin for Firefox (any version).
97
+
98
+  Colored output looks something like:
99
+
100
+  ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
101
+
102
+### stderr vs stdout
103
+
104
+You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
105
+
106
+Example _stderr.js_:
107
+
108
+```js
109
+var debug = require('../');
110
+var log = debug('app:log');
111
+
112
+// by default console.log is used
113
+log('goes to stdout!');
114
+
115
+var error = debug('app:error');
116
+// set this namespace to log via console.error
117
+error.log = console.error.bind(console); // don't forget to bind to console!
118
+error('goes to stderr');
119
+log('still goes to stdout!');
120
+
121
+// set all output to go via console.warn
122
+// overrides all per-namespace log settings
123
+debug.log = console.warn.bind(console);
124
+log('now goes to stderr via console.warn');
125
+error('still goes to stderr, but via console.warn now');
126
+```
127
+
128
+## Authors
129
+
130
+ - TJ Holowaychuk
131
+ - Nathan Rajlich
132
+
133
+## License
134
+
135
+(The MIT License)
136
+
137
+Copyright (c) 2014 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
138
+
139
+Permission is hereby granted, free of charge, to any person obtaining
140
+a copy of this software and associated documentation files (the
141
+'Software'), to deal in the Software without restriction, including
142
+without limitation the rights to use, copy, modify, merge, publish,
143
+distribute, sublicense, and/or sell copies of the Software, and to
144
+permit persons to whom the Software is furnished to do so, subject to
145
+the following conditions:
146
+
147
+The above copyright notice and this permission notice shall be
148
+included in all copies or substantial portions of the Software.
149
+
150
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
151
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
152
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
153
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
154
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
155
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
156
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 147
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/browser.js Прегледај датотеку

@@ -0,0 +1,147 @@
1
+
2
+/**
3
+ * This is the web browser implementation of `debug()`.
4
+ *
5
+ * Expose `debug()` as the module.
6
+ */
7
+
8
+exports = module.exports = require('./debug');
9
+exports.log = log;
10
+exports.formatArgs = formatArgs;
11
+exports.save = save;
12
+exports.load = load;
13
+exports.useColors = useColors;
14
+
15
+/**
16
+ * Colors.
17
+ */
18
+
19
+exports.colors = [
20
+  'lightseagreen',
21
+  'forestgreen',
22
+  'goldenrod',
23
+  'dodgerblue',
24
+  'darkorchid',
25
+  'crimson'
26
+];
27
+
28
+/**
29
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
30
+ * and the Firebug extension (any Firefox version) are known
31
+ * to support "%c" CSS customizations.
32
+ *
33
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
34
+ */
35
+
36
+function useColors() {
37
+  // is webkit? http://stackoverflow.com/a/16459606/376773
38
+  return ('WebkitAppearance' in document.documentElement.style) ||
39
+    // is firebug? http://stackoverflow.com/a/398120/376773
40
+    (window.console && (console.firebug || (console.exception && console.table))) ||
41
+    // is firefox >= v31?
42
+    // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
43
+    (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31);
44
+}
45
+
46
+/**
47
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
48
+ */
49
+
50
+exports.formatters.j = function(v) {
51
+  return JSON.stringify(v);
52
+};
53
+
54
+
55
+/**
56
+ * Colorize log arguments if enabled.
57
+ *
58
+ * @api public
59
+ */
60
+
61
+function formatArgs() {
62
+  var args = arguments;
63
+  var useColors = this.useColors;
64
+
65
+  args[0] = (useColors ? '%c' : '')
66
+    + this.namespace
67
+    + (useColors ? ' %c' : ' ')
68
+    + args[0]
69
+    + (useColors ? '%c ' : ' ')
70
+    + '+' + exports.humanize(this.diff);
71
+
72
+  if (!useColors) return args;
73
+
74
+  var c = 'color: ' + this.color;
75
+  args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));
76
+
77
+  // the final "%c" is somewhat tricky, because there could be other
78
+  // arguments passed either before or after the %c, so we need to
79
+  // figure out the correct index to insert the CSS into
80
+  var index = 0;
81
+  var lastC = 0;
82
+  args[0].replace(/%[a-z%]/g, function(match) {
83
+    if ('%%' === match) return;
84
+    index++;
85
+    if ('%c' === match) {
86
+      // we only are interested in the *last* %c
87
+      // (the user may have provided their own)
88
+      lastC = index;
89
+    }
90
+  });
91
+
92
+  args.splice(lastC, 0, c);
93
+  return args;
94
+}
95
+
96
+/**
97
+ * Invokes `console.log()` when available.
98
+ * No-op when `console.log` is not a "function".
99
+ *
100
+ * @api public
101
+ */
102
+
103
+function log() {
104
+  // This hackery is required for IE8,
105
+  // where the `console.log` function doesn't have 'apply'
106
+  return 'object' == typeof console
107
+    && 'function' == typeof console.log
108
+    && Function.prototype.apply.call(console.log, console, arguments);
109
+}
110
+
111
+/**
112
+ * Save `namespaces`.
113
+ *
114
+ * @param {String} namespaces
115
+ * @api private
116
+ */
117
+
118
+function save(namespaces) {
119
+  try {
120
+    if (null == namespaces) {
121
+      localStorage.removeItem('debug');
122
+    } else {
123
+      localStorage.debug = namespaces;
124
+    }
125
+  } catch(e) {}
126
+}
127
+
128
+/**
129
+ * Load `namespaces`.
130
+ *
131
+ * @return {String} returns the previously persisted debug modes
132
+ * @api private
133
+ */
134
+
135
+function load() {
136
+  var r;
137
+  try {
138
+    r = localStorage.debug;
139
+  } catch(e) {}
140
+  return r;
141
+}
142
+
143
+/**
144
+ * Enable namespaces listed in `localStorage.debug` initially.
145
+ */
146
+
147
+exports.enable(load());

+ 19
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/component.json Прегледај датотеку

@@ -0,0 +1,19 @@
1
+{
2
+  "name": "debug",
3
+  "repo": "visionmedia/debug",
4
+  "description": "small debugging utility",
5
+  "version": "2.1.0",
6
+  "keywords": [
7
+    "debug",
8
+    "log",
9
+    "debugger"
10
+  ],
11
+  "main": "browser.js",
12
+  "scripts": [
13
+    "browser.js",
14
+    "debug.js"
15
+  ],
16
+  "dependencies": {
17
+    "guille/ms.js": "0.6.1"
18
+  }
19
+}

+ 197
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/debug.js Прегледај датотеку

@@ -0,0 +1,197 @@
1
+
2
+/**
3
+ * This is the common logic for both the Node.js and web browser
4
+ * implementations of `debug()`.
5
+ *
6
+ * Expose `debug()` as the module.
7
+ */
8
+
9
+exports = module.exports = debug;
10
+exports.coerce = coerce;
11
+exports.disable = disable;
12
+exports.enable = enable;
13
+exports.enabled = enabled;
14
+exports.humanize = require('ms');
15
+
16
+/**
17
+ * The currently active debug mode names, and names to skip.
18
+ */
19
+
20
+exports.names = [];
21
+exports.skips = [];
22
+
23
+/**
24
+ * Map of special "%n" handling functions, for the debug "format" argument.
25
+ *
26
+ * Valid key names are a single, lowercased letter, i.e. "n".
27
+ */
28
+
29
+exports.formatters = {};
30
+
31
+/**
32
+ * Previously assigned color.
33
+ */
34
+
35
+var prevColor = 0;
36
+
37
+/**
38
+ * Previous log timestamp.
39
+ */
40
+
41
+var prevTime;
42
+
43
+/**
44
+ * Select a color.
45
+ *
46
+ * @return {Number}
47
+ * @api private
48
+ */
49
+
50
+function selectColor() {
51
+  return exports.colors[prevColor++ % exports.colors.length];
52
+}
53
+
54
+/**
55
+ * Create a debugger with the given `namespace`.
56
+ *
57
+ * @param {String} namespace
58
+ * @return {Function}
59
+ * @api public
60
+ */
61
+
62
+function debug(namespace) {
63
+
64
+  // define the `disabled` version
65
+  function disabled() {
66
+  }
67
+  disabled.enabled = false;
68
+
69
+  // define the `enabled` version
70
+  function enabled() {
71
+
72
+    var self = enabled;
73
+
74
+    // set `diff` timestamp
75
+    var curr = +new Date();
76
+    var ms = curr - (prevTime || curr);
77
+    self.diff = ms;
78
+    self.prev = prevTime;
79
+    self.curr = curr;
80
+    prevTime = curr;
81
+
82
+    // add the `color` if not set
83
+    if (null == self.useColors) self.useColors = exports.useColors();
84
+    if (null == self.color && self.useColors) self.color = selectColor();
85
+
86
+    var args = Array.prototype.slice.call(arguments);
87
+
88
+    args[0] = exports.coerce(args[0]);
89
+
90
+    if ('string' !== typeof args[0]) {
91
+      // anything else let's inspect with %o
92
+      args = ['%o'].concat(args);
93
+    }
94
+
95
+    // apply any `formatters` transformations
96
+    var index = 0;
97
+    args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
98
+      // if we encounter an escaped % then don't increase the array index
99
+      if (match === '%%') return match;
100
+      index++;
101
+      var formatter = exports.formatters[format];
102
+      if ('function' === typeof formatter) {
103
+        var val = args[index];
104
+        match = formatter.call(self, val);
105
+
106
+        // now we need to remove `args[index]` since it's inlined in the `format`
107
+        args.splice(index, 1);
108
+        index--;
109
+      }
110
+      return match;
111
+    });
112
+
113
+    if ('function' === typeof exports.formatArgs) {
114
+      args = exports.formatArgs.apply(self, args);
115
+    }
116
+    var logFn = enabled.log || exports.log || console.log.bind(console);
117
+    logFn.apply(self, args);
118
+  }
119
+  enabled.enabled = true;
120
+
121
+  var fn = exports.enabled(namespace) ? enabled : disabled;
122
+
123
+  fn.namespace = namespace;
124
+
125
+  return fn;
126
+}
127
+
128
+/**
129
+ * Enables a debug mode by namespaces. This can include modes
130
+ * separated by a colon and wildcards.
131
+ *
132
+ * @param {String} namespaces
133
+ * @api public
134
+ */
135
+
136
+function enable(namespaces) {
137
+  exports.save(namespaces);
138
+
139
+  var split = (namespaces || '').split(/[\s,]+/);
140
+  var len = split.length;
141
+
142
+  for (var i = 0; i < len; i++) {
143
+    if (!split[i]) continue; // ignore empty strings
144
+    namespaces = split[i].replace(/\*/g, '.*?');
145
+    if (namespaces[0] === '-') {
146
+      exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
147
+    } else {
148
+      exports.names.push(new RegExp('^' + namespaces + '$'));
149
+    }
150
+  }
151
+}
152
+
153
+/**
154
+ * Disable debug output.
155
+ *
156
+ * @api public
157
+ */
158
+
159
+function disable() {
160
+  exports.enable('');
161
+}
162
+
163
+/**
164
+ * Returns true if the given mode name is enabled, false otherwise.
165
+ *
166
+ * @param {String} name
167
+ * @return {Boolean}
168
+ * @api public
169
+ */
170
+
171
+function enabled(name) {
172
+  var i, len;
173
+  for (i = 0, len = exports.skips.length; i < len; i++) {
174
+    if (exports.skips[i].test(name)) {
175
+      return false;
176
+    }
177
+  }
178
+  for (i = 0, len = exports.names.length; i < len; i++) {
179
+    if (exports.names[i].test(name)) {
180
+      return true;
181
+    }
182
+  }
183
+  return false;
184
+}
185
+
186
+/**
187
+ * Coerce `val`.
188
+ *
189
+ * @param {Mixed} val
190
+ * @return {Mixed}
191
+ * @api private
192
+ */
193
+
194
+function coerce(val) {
195
+  if (val instanceof Error) return val.stack || val.message;
196
+  return val;
197
+}

+ 209
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/node.js Прегледај датотеку

@@ -0,0 +1,209 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var tty = require('tty');
7
+var util = require('util');
8
+
9
+/**
10
+ * This is the Node.js implementation of `debug()`.
11
+ *
12
+ * Expose `debug()` as the module.
13
+ */
14
+
15
+exports = module.exports = require('./debug');
16
+exports.log = log;
17
+exports.formatArgs = formatArgs;
18
+exports.save = save;
19
+exports.load = load;
20
+exports.useColors = useColors;
21
+
22
+/**
23
+ * Colors.
24
+ */
25
+
26
+exports.colors = [6, 2, 3, 4, 5, 1];
27
+
28
+/**
29
+ * The file descriptor to write the `debug()` calls to.
30
+ * Set the `DEBUG_FD` env variable to override with another value. i.e.:
31
+ *
32
+ *   $ DEBUG_FD=3 node script.js 3>debug.log
33
+ */
34
+
35
+var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
36
+var stream = 1 === fd ? process.stdout :
37
+             2 === fd ? process.stderr :
38
+             createWritableStdioStream(fd);
39
+
40
+/**
41
+ * Is stdout a TTY? Colored output is enabled when `true`.
42
+ */
43
+
44
+function useColors() {
45
+  var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
46
+  if (0 === debugColors.length) {
47
+    return tty.isatty(fd);
48
+  } else {
49
+    return '0' !== debugColors
50
+        && 'no' !== debugColors
51
+        && 'false' !== debugColors
52
+        && 'disabled' !== debugColors;
53
+  }
54
+}
55
+
56
+/**
57
+ * Map %o to `util.inspect()`, since Node doesn't do that out of the box.
58
+ */
59
+
60
+var inspect = (4 === util.inspect.length ?
61
+  // node <= 0.8.x
62
+  function (v, colors) {
63
+    return util.inspect(v, void 0, void 0, colors);
64
+  } :
65
+  // node > 0.8.x
66
+  function (v, colors) {
67
+    return util.inspect(v, { colors: colors });
68
+  }
69
+);
70
+
71
+exports.formatters.o = function(v) {
72
+  return inspect(v, this.useColors)
73
+    .replace(/\s*\n\s*/g, ' ');
74
+};
75
+
76
+/**
77
+ * Adds ANSI color escape codes if enabled.
78
+ *
79
+ * @api public
80
+ */
81
+
82
+function formatArgs() {
83
+  var args = arguments;
84
+  var useColors = this.useColors;
85
+  var name = this.namespace;
86
+
87
+  if (useColors) {
88
+    var c = this.color;
89
+
90
+    args[0] = '  \u001b[9' + c + 'm' + name + ' '
91
+      + '\u001b[0m'
92
+      + args[0] + '\u001b[3' + c + 'm'
93
+      + ' +' + exports.humanize(this.diff) + '\u001b[0m';
94
+  } else {
95
+    args[0] = new Date().toUTCString()
96
+      + ' ' + name + ' ' + args[0];
97
+  }
98
+  return args;
99
+}
100
+
101
+/**
102
+ * Invokes `console.error()` with the specified arguments.
103
+ */
104
+
105
+function log() {
106
+  return stream.write(util.format.apply(this, arguments) + '\n');
107
+}
108
+
109
+/**
110
+ * Save `namespaces`.
111
+ *
112
+ * @param {String} namespaces
113
+ * @api private
114
+ */
115
+
116
+function save(namespaces) {
117
+  if (null == namespaces) {
118
+    // If you set a process.env field to null or undefined, it gets cast to the
119
+    // string 'null' or 'undefined'. Just delete instead.
120
+    delete process.env.DEBUG;
121
+  } else {
122
+    process.env.DEBUG = namespaces;
123
+  }
124
+}
125
+
126
+/**
127
+ * Load `namespaces`.
128
+ *
129
+ * @return {String} returns the previously persisted debug modes
130
+ * @api private
131
+ */
132
+
133
+function load() {
134
+  return process.env.DEBUG;
135
+}
136
+
137
+/**
138
+ * Copied from `node/src/node.js`.
139
+ *
140
+ * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
141
+ * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
142
+ */
143
+
144
+function createWritableStdioStream (fd) {
145
+  var stream;
146
+  var tty_wrap = process.binding('tty_wrap');
147
+
148
+  // Note stream._type is used for test-module-load-list.js
149
+
150
+  switch (tty_wrap.guessHandleType(fd)) {
151
+    case 'TTY':
152
+      stream = new tty.WriteStream(fd);
153
+      stream._type = 'tty';
154
+
155
+      // Hack to have stream not keep the event loop alive.
156
+      // See https://github.com/joyent/node/issues/1726
157
+      if (stream._handle && stream._handle.unref) {
158
+        stream._handle.unref();
159
+      }
160
+      break;
161
+
162
+    case 'FILE':
163
+      var fs = require('fs');
164
+      stream = new fs.SyncWriteStream(fd, { autoClose: false });
165
+      stream._type = 'fs';
166
+      break;
167
+
168
+    case 'PIPE':
169
+    case 'TCP':
170
+      var net = require('net');
171
+      stream = new net.Socket({
172
+        fd: fd,
173
+        readable: false,
174
+        writable: true
175
+      });
176
+
177
+      // FIXME Should probably have an option in net.Socket to create a
178
+      // stream from an existing fd which is writable only. But for now
179
+      // we'll just add this hack and set the `readable` member to false.
180
+      // Test: ./node test/fixtures/echo.js < /etc/passwd
181
+      stream.readable = false;
182
+      stream.read = null;
183
+      stream._type = 'pipe';
184
+
185
+      // FIXME Hack to have stream not keep the event loop alive.
186
+      // See https://github.com/joyent/node/issues/1726
187
+      if (stream._handle && stream._handle.unref) {
188
+        stream._handle.unref();
189
+      }
190
+      break;
191
+
192
+    default:
193
+      // Probably an error on in uv_guess_handle()
194
+      throw new Error('Implement me. Unknown stream file type!');
195
+  }
196
+
197
+  // For supporting legacy API we put the FD here.
198
+  stream.fd = fd;
199
+
200
+  stream._isStdio = true;
201
+
202
+  return stream;
203
+}
204
+
205
+/**
206
+ * Enable namespaces listed in `process.env.DEBUG` initially.
207
+ */
208
+
209
+exports.enable(load());

+ 5
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/.npmignore Прегледај датотеку

@@ -0,0 +1,5 @@
1
+node_modules
2
+test
3
+History.md
4
+Makefile
5
+component.json

+ 33
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/README.md Прегледај датотеку

@@ -0,0 +1,33 @@
1
+# ms.js: miliseconds conversion utility
2
+
3
+```js
4
+ms('1d')      // 86400000
5
+ms('10h')     // 36000000
6
+ms('2h')      // 7200000
7
+ms('1m')      // 60000
8
+ms('5s')      // 5000
9
+ms('100')     // 100
10
+```
11
+
12
+```js
13
+ms(60000)             // "1m"
14
+ms(2 * 60000)         // "2m"
15
+ms(ms('10 hours'))    // "10h"
16
+```
17
+
18
+```js
19
+ms(60000, { long: true })             // "1 minute"
20
+ms(2 * 60000, { long: true })         // "2 minutes"
21
+ms(ms('10 hours', { long: true }))    // "10 hours"
22
+```
23
+
24
+- Node/Browser compatible. Published as `ms` in NPM.
25
+- If a number is supplied to `ms`, a string with a unit is returned.
26
+- If a string that contains the number is supplied, it returns it as
27
+a number (e.g: it returns `100` for `'100'`).
28
+- If you pass a string with a number and a valid unit, the number of
29
+equivalent ms is returned.
30
+
31
+## License
32
+
33
+MIT

+ 111
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/index.js Прегледај датотеку

@@ -0,0 +1,111 @@
1
+/**
2
+ * Helpers.
3
+ */
4
+
5
+var s = 1000;
6
+var m = s * 60;
7
+var h = m * 60;
8
+var d = h * 24;
9
+var y = d * 365.25;
10
+
11
+/**
12
+ * Parse or format the given `val`.
13
+ *
14
+ * Options:
15
+ *
16
+ *  - `long` verbose formatting [false]
17
+ *
18
+ * @param {String|Number} val
19
+ * @param {Object} options
20
+ * @return {String|Number}
21
+ * @api public
22
+ */
23
+
24
+module.exports = function(val, options){
25
+  options = options || {};
26
+  if ('string' == typeof val) return parse(val);
27
+  return options.long
28
+    ? long(val)
29
+    : short(val);
30
+};
31
+
32
+/**
33
+ * Parse the given `str` and return milliseconds.
34
+ *
35
+ * @param {String} str
36
+ * @return {Number}
37
+ * @api private
38
+ */
39
+
40
+function parse(str) {
41
+  var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
42
+  if (!match) return;
43
+  var n = parseFloat(match[1]);
44
+  var type = (match[2] || 'ms').toLowerCase();
45
+  switch (type) {
46
+    case 'years':
47
+    case 'year':
48
+    case 'y':
49
+      return n * y;
50
+    case 'days':
51
+    case 'day':
52
+    case 'd':
53
+      return n * d;
54
+    case 'hours':
55
+    case 'hour':
56
+    case 'h':
57
+      return n * h;
58
+    case 'minutes':
59
+    case 'minute':
60
+    case 'm':
61
+      return n * m;
62
+    case 'seconds':
63
+    case 'second':
64
+    case 's':
65
+      return n * s;
66
+    case 'ms':
67
+      return n;
68
+  }
69
+}
70
+
71
+/**
72
+ * Short format for `ms`.
73
+ *
74
+ * @param {Number} ms
75
+ * @return {String}
76
+ * @api private
77
+ */
78
+
79
+function short(ms) {
80
+  if (ms >= d) return Math.round(ms / d) + 'd';
81
+  if (ms >= h) return Math.round(ms / h) + 'h';
82
+  if (ms >= m) return Math.round(ms / m) + 'm';
83
+  if (ms >= s) return Math.round(ms / s) + 's';
84
+  return ms + 'ms';
85
+}
86
+
87
+/**
88
+ * Long format for `ms`.
89
+ *
90
+ * @param {Number} ms
91
+ * @return {String}
92
+ * @api private
93
+ */
94
+
95
+function long(ms) {
96
+  return plural(ms, d, 'day')
97
+    || plural(ms, h, 'hour')
98
+    || plural(ms, m, 'minute')
99
+    || plural(ms, s, 'second')
100
+    || ms + ' ms';
101
+}
102
+
103
+/**
104
+ * Pluralization helper.
105
+ */
106
+
107
+function plural(ms, n, name) {
108
+  if (ms < n) return;
109
+  if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
110
+  return Math.ceil(ms / n) + ' ' + name + 's';
111
+}

+ 45
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/node_modules/ms/package.json Прегледај датотеку

@@ -0,0 +1,45 @@
1
+{
2
+  "name": "ms",
3
+  "version": "0.6.2",
4
+  "description": "Tiny ms conversion utility",
5
+  "repository": {
6
+    "type": "git",
7
+    "url": "git://github.com/guille/ms.js.git"
8
+  },
9
+  "main": "./index",
10
+  "devDependencies": {
11
+    "mocha": "*",
12
+    "expect.js": "*",
13
+    "serve": "*"
14
+  },
15
+  "component": {
16
+    "scripts": {
17
+      "ms/index.js": "index.js"
18
+    }
19
+  },
20
+  "bugs": {
21
+    "url": "https://github.com/guille/ms.js/issues"
22
+  },
23
+  "_id": "ms@0.6.2",
24
+  "dist": {
25
+    "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c",
26
+    "tarball": "http://registry.npmjs.org/ms/-/ms-0.6.2.tgz"
27
+  },
28
+  "_from": "ms@0.6.2",
29
+  "_npmVersion": "1.2.30",
30
+  "_npmUser": {
31
+    "name": "rauchg",
32
+    "email": "rauchg@gmail.com"
33
+  },
34
+  "maintainers": [
35
+    {
36
+      "name": "rauchg",
37
+      "email": "rauchg@gmail.com"
38
+    }
39
+  ],
40
+  "directories": {},
41
+  "_shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c",
42
+  "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz",
43
+  "readme": "ERROR: No README data found!",
44
+  "scripts": {}
45
+}

+ 73
- 0
web/multi/server/node_modules/socket.io/node_modules/debug/package.json Прегледај датотеку

@@ -0,0 +1,73 @@
1
+{
2
+  "name": "debug",
3
+  "version": "2.1.0",
4
+  "repository": {
5
+    "type": "git",
6
+    "url": "git://github.com/visionmedia/debug.git"
7
+  },
8
+  "description": "small debugging utility",
9
+  "keywords": [
10
+    "debug",
11
+    "log",
12
+    "debugger"
13
+  ],
14
+  "author": {
15
+    "name": "TJ Holowaychuk",
16
+    "email": "tj@vision-media.ca"
17
+  },
18
+  "contributors": [
19
+    {
20
+      "name": "Nathan Rajlich",
21
+      "email": "nathan@tootallnate.net",
22
+      "url": "http://n8.io"
23
+    }
24
+  ],
25
+  "license": "MIT",
26
+  "dependencies": {
27
+    "ms": "0.6.2"
28
+  },
29
+  "devDependencies": {
30
+    "browserify": "6.1.0",
31
+    "mocha": "*"
32
+  },
33
+  "main": "./node.js",
34
+  "browser": "./browser.js",
35
+  "component": {
36
+    "scripts": {
37
+      "debug/index.js": "browser.js",
38
+      "debug/debug.js": "debug.js"
39
+    }
40
+  },
41
+  "gitHead": "953162b4fa8849268d147f4bac91c737baee55bb",
42
+  "bugs": {
43
+    "url": "https://github.com/visionmedia/debug/issues"
44
+  },
45
+  "homepage": "https://github.com/visionmedia/debug",
46
+  "_id": "debug@2.1.0",
47
+  "scripts": {},
48
+  "_shasum": "33ab915659d8c2cc8a41443d94d6ebd37697ed21",
49
+  "_from": "debug@2.1.0",
50
+  "_npmVersion": "2.1.3",
51
+  "_nodeVersion": "0.10.32",
52
+  "_npmUser": {
53
+    "name": "tootallnate",
54
+    "email": "nathan@tootallnate.net"
55
+  },
56
+  "maintainers": [
57
+    {
58
+      "name": "tjholowaychuk",
59
+      "email": "tj@vision-media.ca"
60
+    },
61
+    {
62
+      "name": "tootallnate",
63
+      "email": "nathan@tootallnate.net"
64
+    }
65
+  ],
66
+  "dist": {
67
+    "shasum": "33ab915659d8c2cc8a41443d94d6ebd37697ed21",
68
+    "tarball": "http://registry.npmjs.org/debug/-/debug-2.1.0.tgz"
69
+  },
70
+  "directories": {},
71
+  "_resolved": "https://registry.npmjs.org/debug/-/debug-2.1.0.tgz",
72
+  "readme": "ERROR: No README data found!"
73
+}

+ 6
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/.npmignore Прегледај датотеку

@@ -0,0 +1,6 @@
1
+examples
2
+node_modules
3
+test
4
+npm-debug.log
5
+coverage.html
6
+.gitignore

+ 7
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/.travis.yml Прегледај датотеку

@@ -0,0 +1,7 @@
1
+language: node_js
2
+node_js:
3
+  - "0.10"
4
+  - "0.8"
5
+
6
+notifications:
7
+  irc: "irc.freenode.org#socket.io"

+ 408
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/History.md Прегледај датотеку

@@ -0,0 +1,408 @@
1
+
2
+1.5.1 / 2015-01-19
3
+==================
4
+
5
+ * no change on this release
6
+ * package: bump `engine.io-client`
7
+
8
+1.5.0 / 2015-01-18
9
+==================
10
+
11
+ * package: bump `engine.io-parser`
12
+ * polling: correctly abort the ongoing data request when closing [lpinca]
13
+ * add cert-related client tests [rase-]
14
+
15
+1.4.3 / 2014-11-21
16
+==================
17
+
18
+ * package: bump `ws` to fix fd leaks
19
+ * socket: flush the write buffer before closing the socket [nkzawa]
20
+ * polling: close the pending poll request when closing transport [nkzawa]
21
+
22
+1.4.2 / 2014-10-08
23
+==================
24
+
25
+ * add iframe onload handling to jsonp tests [rase-]
26
+
27
+1.4.1 / 2014-10-03
28
+==================
29
+
30
+ * socket: allow upgrades if the socket is still in closing state
31
+ * README: fix typo
32
+
33
+1.4.0 / 2014-09-03
34
+==================
35
+
36
+ * readme: fix formatting for goals numbering
37
+ * server: ref fix by @nicokaiser
38
+ * server: fix ws memory leak (fixes #268)
39
+ * cache remote address in handshake since it might be lost later.
40
+ * correct git ref
41
+ * update client to commit with bumped parser
42
+ * package: bump parser
43
+ * npmignore: ignore `.gitignore`
44
+ * package: bump `debug`
45
+ * package: bump `engine.io-parser` for memleak fix
46
+
47
+1.3.1 / 2014-06-19
48
+==================
49
+
50
+ * package: bump `engine.io-client`
51
+
52
+1.3.0 / 2014-06-13
53
+==================
54
+
55
+ * update example to use v1.2.2
56
+ * fixed newline parsing in jsonp
57
+ * make require('engine.io')() return a new Server instance [defunctzombie]
58
+ * add Server.attach method [defunctzombie]
59
+ * fix GH-211, set CORS headers when sending error message [mokesmokes]
60
+
61
+1.2.2 / 2014-05-30
62
+==================
63
+
64
+ * package: bump `engine.io-parser` for binary utf8 fix
65
+
66
+1.2.1 / 2014-05-22
67
+==================
68
+
69
+ * package: bump engine.io-client
70
+
71
+1.2.0 / 2014-05-18
72
+==================
73
+
74
+ * removed flashsocket, moving to userland
75
+
76
+1.1.1 / 2014-05-14
77
+==================
78
+
79
+ * test: reduce packet size
80
+ * package: bump parser
81
+
82
+1.1.0 / 2014-04-27
83
+==================
84
+
85
+ * socket: removed unneeded `clearTimeout` (fixes #250)
86
+ * made the request verification process async
87
+ * package: bump `engine.io-parser`
88
+ * use _query instead of query, fixes compat with restify
89
+ * added a maximum buffer size to received data from polling
90
+ * fixing looping array via for in to normal loop
91
+
92
+1.0.5 / 2014-03-18
93
+==================
94
+
95
+ * package: bump `engine.io-parser` and `engine.io-client`
96
+
97
+1.0.4 / 2014-03-14
98
+==================
99
+
100
+ * package: bump `engine.io-client`
101
+
102
+1.0.3 / 2014-03-12
103
+==================
104
+
105
+ * package: bump `engine.io-client`
106
+
107
+1.0.2 / 2014-03-12
108
+==================
109
+
110
+ * bump engine.io-client
111
+
112
+1.0.1 / 2014-03-06
113
+==================
114
+
115
+ * package: bump `engine.io-parser`
116
+ * transports: fix jshint warnings and style
117
+
118
+1.0.0 / 2014-03-06
119
+==================
120
+
121
+ * polling-xhr: added `OPTIONS` support, fixes CORS
122
+ * close() properly when triggered in connection handler
123
+ * fix DDOS vector by setting up too many intervals
124
+ * binary support
125
+
126
+0.9.0 / 2014-02-09
127
+==================
128
+
129
+ * Prevent errors with connections behind proxies without WS support
130
+   like Squid [nicklagrow, samaanghani, davidhcummings]
131
+ * Socket#request a simple property [mokesmokes]
132
+ * Changed `Socket`'s `upgrade` event to happen after upgrade [mokesmokes]
133
+ * Document `Socket#id` [mokesmokes]
134
+
135
+0.8.2 / 2014-01-18
136
+==================
137
+
138
+ * package: bump `engine.io-client`
139
+
140
+0.8.1 / 2014-01-17
141
+==================
142
+
143
+ * package: bump `engine.io-client`
144
+ * package: pin dev deps
145
+ * examples: fix port output
146
+ * fix latency example
147
+
148
+0.8.0 / 2014-01-05
149
+==================
150
+
151
+ * package: bump `engine.io-client` to `0.8.0`
152
+ * test: fix syntax, remove globals
153
+
154
+0.7.14 / 2014-01-01
155
+===================
156
+
157
+ * package: bump `engine.io-client` to `0.7.14`
158
+
159
+0.7.13 / 2013-12-20
160
+===================
161
+
162
+ * package: bump `engine.io-client`
163
+ * transports: added support for XSS filters on IE [guille, 3rd-eden]
164
+
165
+0.7.12 / 2013-11-11
166
+===================
167
+
168
+ * package: bump `engine.io-client`
169
+
170
+0.7.11 / 2013-11-06
171
+===================
172
+
173
+ * package: bump engine.io-client
174
+ * fix GH-198
175
+
176
+0.7.10 / 2013-10-28
177
+===================
178
+
179
+ * package: bump `engine.io-client`
180
+ * package: update "ws" to v0.4.31
181
+
182
+0.7.9 / 2013-08-30
183
+==================
184
+
185
+ * package: bump `engine.io-client`
186
+
187
+0.7.8 / 2013-08-30
188
+==================
189
+
190
+ * package: bump `engine.io-client`
191
+ * package: bump ws
192
+
193
+0.7.7 / 2013-08-30
194
+==================
195
+
196
+ * package: bump `engine.io-client`
197
+
198
+0.7.6 / 2013-08-30
199
+==================
200
+
201
+ * package: bump engine.io-client
202
+
203
+0.7.5 / 2013-08-30
204
+==================
205
+
206
+ * package: bump engine.io-client
207
+
208
+0.7.4 / 2013-08-25
209
+==================
210
+
211
+ * package: bump `engine.io-client`
212
+
213
+0.7.3 / 2013-08-23
214
+==================
215
+
216
+ * package: bump engine.io-client (noop)
217
+ * package: fix regresison in upgrade cause by ws update
218
+
219
+0.7.2 / 2013-08-23
220
+==================
221
+
222
+ * package: bump `engine.io-client` for `WebSocket` browser fix
223
+
224
+0.7.1 / 2013-08-23
225
+==================
226
+
227
+ * package: bump engine.io-client for ws fix
228
+
229
+0.7.0 / 2013-08-23
230
+==================
231
+
232
+ * package: bump engine.io-client
233
+ * updated example
234
+ * inline merge
235
+ * added support node version 0.10 to .travis.yml
236
+ * fixed respond to flash policy request test. Closes #184
237
+ * fixed upgrade with timeout test. Closes #185
238
+ * engine.io: don't use __proto__, closes #170
239
+
240
+0.6.3 / 2013-06-21
241
+==================
242
+
243
+  * package: bumped `engine.io-client` to `0.6.3`
244
+
245
+0.6.2 / 2013-06-15
246
+==================
247
+
248
+  * fix upgrade stalling edge case introduced with #174 fix
249
+  * remove unneeded client code related to iOS
250
+  * added test for `engine.io-client` `0.6.1`
251
+
252
+0.6.1 / 2013-06-06
253
+==================
254
+
255
+  * package: bumped `engine.io-client` to `0.6.1`
256
+
257
+0.6.0 / 2013-05-31
258
+==================
259
+
260
+  * socket: clear timer after sending one noop packet (fixes #174)
261
+  * clear all timers on socket close
262
+  * sending error on transport creation upon a bad request
263
+  * added test for client-side buffer cleanup
264
+  * changed flushComplete to flush
265
+  * ended support for node 0.6
266
+
267
+0.5.0 / 2013-03-16
268
+==================
269
+
270
+  * polling: implemented new parser
271
+  * test writeBuffer isn't cleared onError, removed 'closing' check in .flush()
272
+  * fixed bug89 and added tests: writeBuffer not flushed until nextTick
273
+
274
+0.4.3 / 2013-02-08
275
+==================
276
+
277
+  * package: bumped `engine.io-client` to `0.4.3`
278
+
279
+0.4.2 / 2013-02-08
280
+==================
281
+
282
+  * Only end upgrade socket connections if unhandled
283
+  * Fix websocket dependency
284
+  * Close socket if upgrade is received and socket.readyState != open
285
+
286
+0.4.1 / 2013-01-18
287
+==================
288
+
289
+  * package: bumped versions
290
+  * Fixed bugs in previous send callback fix and updated test cases
291
+  * Added a test case which makes the code before the send callback fix fail
292
+  * socket: emit `data` event (synonym with `message`)
293
+  * socket: added `Socket#write`
294
+  * engine.io: cleanup
295
+  * engine.io: deprecated `resource`
296
+  * `npm docs engine.io` works now
297
+
298
+0.3.10 / 2012-12-03
299
+===================
300
+
301
+  * package: bumped `engine.io-client` with `close` fixes
302
+  * add packetCreate event [jxck]
303
+  * add packet event to socket [jxck]
304
+  * transport: remove `Connection` headers and let node handle it
305
+  * server: send validation failure reason to clients
306
+  * engine: invoking as a function causes attach
307
+  * socket: reset `writeBuffer` before send
308
+
309
+0.3.9 / 2012-10-23
310
+==================
311
+
312
+  * package: bumped `engine.io-client`
313
+
314
+0.3.8 / 2012-10-23
315
+==================
316
+
317
+  * package: bumped engine.io-client
318
+  * examples: added first example
319
+
320
+0.3.7 / 2012-10-21
321
+==================
322
+
323
+  * package: bumped `engine.io-client`
324
+
325
+0.3.6 / 2012-10-21
326
+==================
327
+
328
+  [skipped]
329
+
330
+0.3.5 / 2012-10-14
331
+==================
332
+
333
+  * package: reverted last commit - we use the parser from the client
334
+
335
+0.3.4 / 2012-10-14
336
+==================
337
+
338
+  * package: `engine.io-client` moved to `devDependencies`
339
+  * socket: added missing jsdoc
340
+
341
+0.3.3 / 2012-10-10
342
+==================
343
+
344
+  * socket: fixed check interval clearing [joewalnes]
345
+  * transports: improved instrumentation
346
+
347
+0.3.2 / 2012-10-08
348
+==================
349
+
350
+  * socket: improve check interval for upgrade
351
+
352
+0.3.1 / 2012-10-08
353
+==================
354
+
355
+  * socket: faster upgrades (we perform a check immediately)
356
+  * server: don't assume sid is numeric
357
+
358
+0.3.0 / 2012-10-04
359
+==================
360
+
361
+  * socket: `writeBuffer` now gets sliced, and is recoverable after `close` [afshinm]
362
+  * server: expect ping from client and send interval with handshake [cadorn]
363
+  * polling-jsonp: prevent client breakage with utf8 whitespace
364
+  * socket: fix `flush` and `drain` events
365
+  * socket: add `send` callback [afshinm]
366
+  * transport: avoid unhandled error events for stale transports
367
+  * README: documentation improvements [EugenDueck]
368
+
369
+0.2.2 / 2012-08-26
370
+==================
371
+
372
+  * server: remove buffering for flash policy requests
373
+  * transport: avoid unhandled error events for stale transports (fixes #69)
374
+  * readme: documented `toString` behavior on `send` [EugenDueck]
375
+
376
+0.2.1 / 2012-08-13
377
+==================
378
+
379
+  * polling-xhr: skip Keep-Alive when it's implied [EugenDueck]
380
+  * polling-jsonp: skip Keep-Alive when it's implied [EugenDueck]
381
+  * README: added plugins list with engine.io-conflation
382
+  * socket: added flush/drain events (fixes #56)
383
+  * server: avoid passing websocket to non-websocket transports (fixes #24)
384
+
385
+0.2.0 / 2012-08-06
386
+==================
387
+
388
+  * Bumped client
389
+  * test: added closing connection test
390
+  * server: implemented stronger id generator with collision detection
391
+
392
+0.1.2 / 2012-08-02
393
+==================
394
+
395
+  * Fixed a jsonp bug in Nokia mobile phones and potentially other UAs.
396
+
397
+0.1.1 / 2012-08-01
398
+==================
399
+
400
+  * Fixed errors when a socket is closed while upgrade probe is happening.
401
+  * Improved WS error handling
402
+  * Replaced websocket.io with ws, now that it supports older drafts
403
+  * README fixes
404
+
405
+0.1.0 / 2012-07-03
406
+==================
407
+
408
+  * Initial release.

+ 23
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/Makefile Прегледај датотеку

@@ -0,0 +1,23 @@
1
+
2
+TESTS = test/*.js
3
+BENCHMARKS = $(shell find bench -type f ! -name 'runner.js')
4
+REPORTER = dot
5
+
6
+test:
7
+	@./node_modules/.bin/mocha \
8
+		--reporter $(REPORTER) \
9
+		--slow 500ms \
10
+		--bail \
11
+		--globals ___eio,document \
12
+		$(TESTS)
13
+
14
+test-cov: lib-cov
15
+	EIO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html
16
+
17
+lib-cov:
18
+	jscoverage --no-highlight lib lib-cov
19
+
20
+bench:
21
+	@node $(PROFILEFLAGS) bench/runner.js $(BENCHMARKS)
22
+
23
+.PHONY: test test-cov bench

+ 517
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/README.md Прегледај датотеку

@@ -0,0 +1,517 @@
1
+
2
+# Engine.IO: the realtime engine
3
+
4
+[![Build Status](https://secure.travis-ci.org/Automattic/engine.io.png)](http://travis-ci.org/Automattic/engine.io)
5
+[![NPM version](https://badge.fury.io/js/engine.io.png)](http://badge.fury.io/js/engine.io)
6
+
7
+`Engine.IO` is the implementation of transport-based
8
+cross-browser/cross-device bi-directional communication layer for
9
+[Socket.IO](http://github.com/learnboost/socket.io).
10
+
11
+## How to use
12
+
13
+### Server
14
+
15
+#### (A) Listening on a port
16
+
17
+```js
18
+var engine = require('engine.io');
19
+var server = engine.listen(80);
20
+
21
+server.on('connection', function(socket){
22
+  socket.send('utf 8 string');
23
+  socket.send(new Buffer([0, 1, 2, 3, 4, 5])); // binary data
24
+});
25
+```
26
+
27
+#### (B) Intercepting requests for a http.Server
28
+
29
+```js
30
+var engine = require('engine.io');
31
+var http = require('http').createServer().listen(3000);
32
+var server = engine.attach(http);
33
+
34
+server.on('connection', function (socket) {
35
+  socket.on('message', function(data){ });
36
+  socket.on('close', function(){ });
37
+});
38
+```
39
+
40
+#### (C) Passing in requests
41
+
42
+```js
43
+var engine = require('engine.io');
44
+var server = new engine.Server();
45
+
46
+server.on('connection', function(socket){
47
+  socket.send('hi');
48
+});
49
+
50
+// …
51
+httpServer.on('upgrade', function(req, socket, head){
52
+  server.handleUpgrade(req, socket, head);
53
+});
54
+httpServer.on('request', function(req, res){
55
+  server.handleRequest(req, res);
56
+});
57
+```
58
+
59
+### Client
60
+
61
+```html
62
+<script src="/path/to/engine.io.js"></script>
63
+<script>
64
+  var socket = new eio.Socket('ws://localhost/');
65
+  socket.on('open', function(){
66
+    socket.on('message', function(data){});
67
+    socket.on('close', function(){});
68
+  });
69
+</script>
70
+```
71
+
72
+For more information on the client refer to the
73
+[engine-client](http://github.com/learnboost/engine.io-client) repository.
74
+
75
+## What features does it have?
76
+
77
+- **Maximum reliability**. Connections are established even in the presence of:
78
+  - proxies and load balancers.
79
+  - personal firewall and antivirus software.
80
+  - for more information refer to **Goals** and **Architecture** sections
81
+- **Minimal client size** aided by:
82
+  - lazy loading of flash transports.
83
+  - lack of redundant transports.
84
+- **Scalable**
85
+  - load balancer friendly
86
+- **Future proof**
87
+- **100% Node.JS core style**
88
+  - No API sugar (left for higher level projects)
89
+  - Written in readable vanilla JavaScript
90
+
91
+## API
92
+
93
+### Server
94
+
95
+<hr><br>
96
+
97
+#### Top-level
98
+
99
+These are exposed by `require('engine.io')`:
100
+
101
+##### Events
102
+
103
+- `flush`
104
+    - Called when a socket buffer is being flushed.
105
+    - **Arguments**
106
+      - `Socket`: socket being flushed
107
+      - `Array`: write buffer
108
+- `drain`
109
+    - Called when a socket buffer is drained
110
+    - **Arguments**
111
+      - `Socket`: socket being flushed
112
+
113
+##### Properties
114
+
115
+- `protocol` _(Number)_: protocol revision number
116
+- `Server`: Server class constructor
117
+- `Socket`: Socket class constructor
118
+- `Transport` _(Function)_: transport constructor
119
+- `transports` _(Object)_: map of available transports
120
+
121
+##### Methods
122
+
123
+- `()`
124
+    - Returns a new `Server` instance. If the first argument is an `http.Server` then the
125
+      new `Server` instance will be attached to it. Otherwise, the arguments are passed
126
+      directly to the `Server` constructor.
127
+    - **Parameters**
128
+      - `http.Server`: optional, server to attach to.
129
+      - `Object`: optional, options object (see `Server#constructor` api docs below)
130
+
131
+  The following are identical ways to instantiate a server and then attach it.
132
+  ```js
133
+  var httpServer; // previously created with `http.createServer();` from node.js api.
134
+
135
+  // create a server first, and then attach
136
+  var eioServer = require('engine.io').Server();
137
+  eioServer.attach(httpServer);
138
+
139
+  // or call the module as a function to get `Server`
140
+  var eioServer = require('engine.io')();
141
+  eioServer.attach(httpServer);
142
+
143
+  // immediately attach
144
+  var eioServer = require('engine.io')(httpServer);
145
+  ```
146
+
147
+- `listen`
148
+    - Creates an `http.Server` which listens on the given port and attaches WS
149
+      to it. It returns `501 Not Implemented` for regular http requests.
150
+    - **Parameters**
151
+      - `Number`: port to listen on.
152
+      - `Object`: optional, options object
153
+      - `Function`: callback for `listen`.
154
+    - **Options**
155
+      - All options from `Server.attach` method, documented below.
156
+      - **Additionally** See Server `constructor` below for options you can pass for creating the new Server
157
+    - **Returns** `Server`
158
+- `attach`
159
+    - Captures `upgrade` requests for a `http.Server`. In other words, makes
160
+      a regular http.Server WebSocket-compatible.
161
+    - **Parameters**
162
+      - `http.Server`: server to attach to.
163
+      - `Object`: optional, options object
164
+    - **Options**
165
+      - All options from `Server.attach` method, documented below.
166
+      - **Additionally** See Server `constructor` below for options you can pass for creating the new Server
167
+    - **Returns** `Server` a new Server instance.
168
+
169
+<hr><br>
170
+
171
+#### Server
172
+
173
+The main server/manager. _Inherits from EventEmitter_.
174
+
175
+##### Events
176
+
177
+- `connection`
178
+    - Fired when a new connection is established.
179
+    - **Arguments**
180
+      - `Socket`: a Socket object
181
+
182
+##### Properties
183
+
184
+**Important**: if you plan to use Engine.IO in a scalable way, please
185
+keep in mind the properties below will only reflect the clients connected
186
+to a single process.
187
+
188
+- `clients` _(Object)_: hash of connected clients by id.
189
+- `clientsCount` _(Number)_: number of connected clients.
190
+
191
+##### Methods
192
+
193
+- **constructor**
194
+    - Initializes the server
195
+    - **Parameters**
196
+      - `Object`: optional, options object
197
+    - **Options**
198
+      - `pingTimeout` (`Number`): how many ms without a pong packet to
199
+        consider the connection closed (`60000`)
200
+      - `pingInterval` (`Number`): how many ms before sending a new ping
201
+        packet (`25000`)
202
+      - `maxHttpBufferSize` (`Number`): how many bytes or characters a message
203
+        can be when polling, before closing the session (to avoid DoS). Default
204
+        value is `10E7`.
205
+      - `allowRequest` (`Function`): A function that receives a given handshake
206
+        or upgrade request as its first parameter, and can decide whether to
207
+        continue or not. The second argument is a function that needs to be
208
+        called with the decided information: `fn(err, success)`, where
209
+        `success` is a boolean value where false means that the request is
210
+        rejected, and err is an error code.
211
+      - `transports` (`<Array> String`): transports to allow connections
212
+        to (`['polling', 'websocket']`)
213
+      - `allowUpgrades` (`Boolean`): whether to allow transport upgrades
214
+        (`true`)
215
+      - `cookie` (`String|Boolean`): name of the HTTP cookie that
216
+        contains the client sid to send as part of handshake response
217
+        headers. Set to `false` to not send one. (`io`)
218
+- `close`
219
+    - Closes all clients
220
+    - **Returns** `Server` for chaining
221
+- `handleRequest`
222
+    - Called internally when a `Engine` request is intercepted.
223
+    - **Parameters**
224
+      - `http.ServerRequest`: a node request object
225
+      - `http.ServerResponse`: a node response object
226
+    - **Returns** `Server` for chaining
227
+- `handleUpgrade`
228
+    - Called internally when a `Engine` ws upgrade is intercepted.
229
+    - **Parameters** (same as `upgrade` event)
230
+      - `http.ServerRequest`: a node request object
231
+      - `net.Stream`: TCP socket for the request
232
+      - `Buffer`: legacy tail bytes
233
+    - **Returns** `Server` for chaining
234
+- `attach`
235
+    - Attach this Server instance to an `http.Server`
236
+    - Captures `upgrade` requests for a `http.Server`. In other words, makes
237
+      a regular http.Server WebSocket-compatible.
238
+    - **Parameters**
239
+      - `http.Server`: server to attach to.
240
+      - `Object`: optional, options object
241
+    - **Options**
242
+      - `path` (`String`): name of the path to capture (`/engine.io`).
243
+      - `destroyUpgrade` (`Boolean`): destroy unhandled upgrade requests (`true`)
244
+      - `destroyUpgradeTimeout` (`Number`): milliseconds after which unhandled requests are ended (`1000`)
245
+
246
+<hr><br>
247
+
248
+#### Socket
249
+
250
+A representation of a client. _Inherits from EventEmitter_.
251
+
252
+##### Events
253
+
254
+- `close`
255
+    - Fired when the client is disconnected.
256
+    - **Arguments**
257
+      - `String`: reason for closing
258
+      - `Object`: description object (optional)
259
+- `message`
260
+    - Fired when the client sends a message.
261
+    - **Arguments**
262
+      - `String` or `Buffer`: Unicode string or Buffer with binary contents
263
+- `error`
264
+    - Fired when an error occurs.
265
+    - **Arguments**
266
+      - `Error`: error object
267
+- `flush`
268
+    - Called when the write buffer is being flushed.
269
+    - **Arguments**
270
+      - `Array`: write buffer
271
+- `drain`
272
+    - Called when the write buffer is drained
273
+- `packet`
274
+    - Called when a socket received a packet (`message`, `ping`)
275
+    - **Arguments**
276
+      - `type`: packet type
277
+      - `data`: packet data (if type is message)
278
+- `packetCreate`
279
+    - Called before a socket sends a packet (`message`, `pong`)
280
+    - **Arguments**
281
+      - `type`: packet type
282
+      - `data`: packet data (if type is message)
283
+
284
+##### Properties
285
+
286
+- `id` _(String)_: unique identifier
287
+- `server` _(Server)_: engine parent reference
288
+- `request` _(http.ServerRequest)_: request that originated the Socket
289
+- `upgraded` _(Boolean)_: whether the transport has been upgraded
290
+- `readyState` _(String)_: opening|open|closing|closed
291
+- `transport` _(Transport)_: transport reference
292
+
293
+##### Methods
294
+
295
+- `send`:
296
+    - Sends a message, performing `message = toString(arguments[0])` unless
297
+      sending binary data, which is sent as is.
298
+    - **Parameters**
299
+      - `String` | `Buffer` | `ArrayBuffer` | `ArrayBufferView`: a string or any object implementing `toString()`, with outgoing data, or a Buffer or ArrayBuffer with binary data. Also any ArrayBufferView can be sent as is.
300
+      - `Function`: optional, a callback executed when the message gets flushed out by the transport
301
+    - **Returns** `Socket` for chaining
302
+- `close`
303
+    - Disconnects the client
304
+    - **Returns** `Socket` for chaining
305
+
306
+### Client
307
+
308
+<hr><br>
309
+
310
+Exposed in the `eio` global namespace (in the browser), or by
311
+`require('engine.io-client')` (in Node.JS).
312
+
313
+For the client API refer to the 
314
+[engine-client](http://github.com/learnboost/engine.io-client) repository.
315
+
316
+## Debug / logging
317
+
318
+Engine.IO is powered by [debug](http://github.com/visionmedia/debug).
319
+In order to see all the debug output, run your app with the environment variable
320
+`DEBUG` including the desired scope.
321
+
322
+To see the output from all of Engine.IO's debugging scopes you can use:
323
+
324
+```
325
+DEBUG=engine* node myapp
326
+```
327
+
328
+## Transports
329
+
330
+- `polling`: XHR / JSONP polling transport.
331
+- `websocket`: WebSocket transport.
332
+
333
+## Plugins
334
+
335
+- [engine.io-conflation](https://github.com/EugenDueck/engine.io-conflation): Makes **conflation and aggregation** of messages straightforward.
336
+
337
+## Support
338
+
339
+The support channels for `engine.io` are the same as `socket.io`:
340
+  - irc.freenode.net **#socket.io**
341
+  - [Google Groups](http://groups.google.com/group/socket_io)
342
+  - [Website](http://socket.io)
343
+
344
+## Development
345
+
346
+To contribute patches, run tests or benchmarks, make sure to clone the
347
+repository:
348
+
349
+```
350
+git clone git://github.com/LearnBoost/engine.io.git
351
+```
352
+
353
+Then:
354
+
355
+```
356
+cd engine.io
357
+npm install
358
+```
359
+
360
+## Tests
361
+
362
+Tests run with `make test`. It runs the server tests that are aided by
363
+the usage of `engine.io-client`.
364
+
365
+Make sure `npm install` is run first.
366
+
367
+## Goals
368
+
369
+The main goal of `Engine` is ensuring the most reliable realtime communication.
370
+Unlike the previous Socket.IO core, it always establishes a long-polling
371
+connection first, then tries to upgrade to better transports that are "tested" on
372
+the side.
373
+
374
+During the lifetime of the Socket.IO projects, we've found countless drawbacks
375
+to relying on `HTML5 WebSocket` or `Flash Socket` as the first connection
376
+mechanisms.
377
+
378
+Both are clearly the _right way_ of establishing a bidirectional communication,
379
+with HTML5 WebSocket being the way of the future. However, to answer most business
380
+needs, alternative traditional HTTP 1.1 mechanisms are just as good as delivering
381
+the same solution.
382
+
383
+WebSocket based connections have two fundamental benefits:
384
+
385
+1. **Better server performance**
386
+  - _A: Load balancers_<br>
387
+      Load balancing a long polling connection poses a serious architectural nightmare
388
+      since requests can come from any number of open sockets by the user agent, but
389
+      they all need to be routed to the process and computer that owns the `Engine`
390
+      connection. This negatively impacts RAM and CPU usage.
391
+  - _B: Network traffic_<br>
392
+      WebSocket is designed around the premise that each message frame has to be 
393
+      surrounded by the least amount of data. In HTTP 1.1 transports, each message
394
+      frame is surrounded by HTTP headers and chunked encoding frames. If you try to
395
+      send the message _"Hello world"_ with xhr-polling, the message ultimately
396
+      becomes larger than if you were to send it with WebSocket.
397
+  - _C: Lightweight parser_<br>
398
+      As an effect of **B**, the server has to do a lot more work to parse the network
399
+      data and figure out the message when traditional HTTP requests are used
400
+      (as in long polling). This means that another advantage of WebSocket is
401
+      less server CPU usage.
402
+
403
+2. **Better user experience**
404
+
405
+    Due to the reasons stated in point **1**, the most important effect of being able
406
+    to establish a WebSocket connection is raw data transfer speed, which translates
407
+    in _some_ cases in better user experience.
408
+
409
+    Applications with heavy realtime interaction (such as games) will benefit greatly,
410
+    whereas applications like realtime chat (Gmail/Facebook), newsfeeds (Facebook) or
411
+    timelines (Twitter) will have negligible user experience improvements.
412
+
413
+Having said this, attempting to establish a WebSocket connection directly so far has
414
+proven problematic:
415
+
416
+1. **Proxies**<br>
417
+    Many corporate proxies block WebSocket traffic.
418
+
419
+2. **Personal firewall and antivirus software**<br>
420
+    As a result of our research, we've found that at least 3 personal security
421
+    applications block WebSocket traffic.
422
+
423
+3. **Cloud application platforms**<br>
424
+    Platforms like Heroku or No.de have had trouble keeping up with the fast-paced
425
+    nature of the evolution of the WebSocket protocol. Applications therefore end up
426
+    inevitably using long polling, but the seamless installation experience of 
427
+    Socket.IO we strive for (_"require() it and it just works"_) disappears.
428
+
429
+Some of these problems have solutions. In the case of proxies and personal programs,
430
+however, the solutions many times involve upgrading software. Experience has shown
431
+that relying on client software upgrades to deliver a business solution is
432
+fruitless: the very existence of this project has to do with a fragmented panorama
433
+of user agent distribution, with clients connecting with latest versions of the most
434
+modern user agents (Chrome, Firefox and Safari), but others with versions as low as
435
+IE 5.5.
436
+
437
+From the user perspective, an unsuccessful WebSocket connection can translate in
438
+up to at least 10 seconds of waiting for the realtime application to begin
439
+exchanging data. This **perceptively** hurts user experience.
440
+
441
+To summarize, **Engine** focuses on reliability and user experience first, marginal
442
+potential UX improvements and increased server performance second. `Engine` is the
443
+result of all the lessons learned with WebSocket in the wild.
444
+
445
+## Architecture
446
+
447
+The main premise of `Engine`, and the core of its existence, is the ability to
448
+swap transports on the fly. A connection starts as xhr-polling, but it can
449
+switch to WebSocket.
450
+
451
+The central problem this poses is: how do we switch transports without losing
452
+messages?
453
+
454
+`Engine` only switches from polling to another transport in between polling
455
+cycles. Since the server closes the connection after a certain timeout when
456
+there's no activity, and the polling transport implementation buffers messages
457
+in between connections, this ensures no message loss and optimal performance.
458
+
459
+Another benefit of this design is that we workaround almost all the limitations
460
+of **Flash Socket**, such as slow connection times, increased file size (we can
461
+safely lazy load it without hurting user experience), etc.
462
+
463
+## FAQ
464
+
465
+### Can I use engine without Socket.IO ?
466
+
467
+Absolutely. Although the recommended framework for building realtime applications
468
+is Socket.IO, since it provides fundamental features for real-world applications 
469
+such as multiplexing, reconnection support, etc.
470
+
471
+`Engine` is to Socket.IO what Connect is to Express. An essential piece for building
472
+realtime frameworks, but something you _probably_ won't be using for building
473
+actual applications.
474
+
475
+### Does the server serve the client?
476
+
477
+No. The main reason is that `Engine` is meant to be bundled with frameworks.
478
+Socket.IO includes `Engine`, therefore serving two clients is not necessary. If
479
+you use Socket.IO, including
480
+
481
+```html
482
+<script src="/socket.io/socket.io.js">
483
+```
484
+
485
+has you covered.
486
+
487
+### Can I implement `Engine` in other languages?
488
+
489
+Absolutely. The [engine.io-protocol](https://github.com/LearnBoost/engine.io-protocol)
490
+repository contains the most up to date description of the specification
491
+at all times, and the parser implementation in JavaScript.
492
+
493
+## License 
494
+
495
+(The MIT License)
496
+
497
+Copyright (c) 2014 Guillermo Rauch &lt;guillermo@learnboost.com&gt;
498
+
499
+Permission is hereby granted, free of charge, to any person obtaining
500
+a copy of this software and associated documentation files (the
501
+'Software'), to deal in the Software without restriction, including
502
+without limitation the rights to use, copy, modify, merge, publish,
503
+distribute, sublicense, and/or sell copies of the Software, and to
504
+permit persons to whom the Software is furnished to do so, subject to
505
+the following conditions:
506
+
507
+The above copyright notice and this permission notice shall be
508
+included in all copies or substantial portions of the Software.
509
+
510
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
511
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
512
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
513
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
514
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
515
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
516
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
517
+

+ 4
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/index.js Прегледај датотеку

@@ -0,0 +1,4 @@
1
+
2
+module.exports = process.env.EIO_COV
3
+  ? require('./lib-cov/engine.io')
4
+  : require('./lib/engine.io');

+ 126
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/engine.io.js Прегледај датотеку

@@ -0,0 +1,126 @@
1
+/**
2
+ * Module dependencies.
3
+ */
4
+
5
+var http = require('http');
6
+
7
+/**
8
+ * Invoking the library as a function delegates to attach if the first argument
9
+ * is an `http.Server`.
10
+ *
11
+ * If there are no arguments or the first argument is an options object, then
12
+ * a new Server instance is returned.
13
+ *
14
+ * @param {http.Server} server (if specified, will be attached to by the new Server instance)
15
+ * @param {Object} options
16
+ * @return {Server} engine server
17
+ * @api public
18
+ */
19
+
20
+exports = module.exports = function() {
21
+  // backwards compatible use as `.attach`
22
+  // if first argument is an http server
23
+  if (arguments.length && arguments[0] instanceof http.Server) {
24
+    return attach.apply(this, arguments);
25
+  }
26
+
27
+  // if first argument is not an http server, then just make a regular eio server
28
+  return exports.Server.apply(null, arguments);
29
+};
30
+
31
+/**
32
+ * Protocol revision number.
33
+ *
34
+ * @api public
35
+ */
36
+
37
+exports.protocol = 1;
38
+
39
+/**
40
+ * Expose Server constructor.
41
+ *
42
+ * @api public
43
+ */
44
+
45
+exports.Server = require('./server');
46
+
47
+/**
48
+ * Expose Server constructor.
49
+ *
50
+ * @api public
51
+ */
52
+
53
+exports.Socket = require('./socket');
54
+
55
+/**
56
+ * Expose Transport constructor.
57
+ *
58
+ * @api public
59
+ */
60
+
61
+exports.Transport = require('./transport');
62
+
63
+/**
64
+ * Expose mutable list of available transports.
65
+ *
66
+ * @api public
67
+ */
68
+
69
+exports.transports = require('./transports');
70
+
71
+/**
72
+ * Exports parser.
73
+ *
74
+ * @api public
75
+ */
76
+
77
+exports.parser = require('engine.io-parser');
78
+
79
+/**
80
+ * Creates an http.Server exclusively used for WS upgrades.
81
+ *
82
+ * @param {Number} port
83
+ * @param {Function} callback
84
+ * @param {Object} options
85
+ * @return {Server} websocket.io server
86
+ * @api public
87
+ */
88
+
89
+exports.listen = listen;
90
+
91
+function listen(port, options, fn) {
92
+  if ('function' == typeof options) {
93
+    fn = options;
94
+    options = {};
95
+  }
96
+
97
+  var server = http.createServer(function (req, res) {
98
+    res.writeHead(501);
99
+    res.end('Not Implemented');
100
+  });
101
+
102
+  server.listen(port, fn);
103
+
104
+  // create engine server
105
+  var engine = exports.attach(server, options);
106
+  engine.httpServer = server;
107
+
108
+  return engine;
109
+};
110
+
111
+/**
112
+ * Captures upgrade requests for a http.Server.
113
+ *
114
+ * @param {http.Server} server
115
+ * @param {Object} options
116
+ * @return {Server} engine server
117
+ * @api public
118
+ */
119
+
120
+exports.attach = attach;
121
+
122
+function attach(server, options) {
123
+  var engine = new exports.Server(options);
124
+  engine.attach(server, options);
125
+  return engine;
126
+};

+ 391
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/server.js Прегледај датотеку

@@ -0,0 +1,391 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var qs = require('querystring')
7
+  , parse = require('url').parse
8
+  , readFileSync = require('fs').readFileSync
9
+  , crypto = require('crypto')
10
+  , base64id = require('base64id')
11
+  , transports = require('./transports')
12
+  , EventEmitter = require('events').EventEmitter
13
+  , Socket = require('./socket')
14
+  , WebSocketServer = require('ws').Server
15
+  , debug = require('debug')('engine');
16
+
17
+/**
18
+ * Module exports.
19
+ */
20
+
21
+module.exports = Server;
22
+
23
+/**
24
+ * Server constructor.
25
+ *
26
+ * @param {Object} options
27
+ * @api public
28
+ */
29
+
30
+function Server(opts){
31
+  if (!(this instanceof Server)) {
32
+    return new Server(opts);
33
+  }
34
+
35
+  this.clients = {};
36
+  this.clientsCount = 0;
37
+
38
+  opts = opts || {};
39
+  this.pingTimeout = opts.pingTimeout || 60000;
40
+  this.pingInterval = opts.pingInterval || 25000;
41
+  this.upgradeTimeout = opts.upgradeTimeout || 10000;
42
+  this.maxHttpBufferSize = opts.maxHttpBufferSize || 10E7;
43
+  this.transports = opts.transports || Object.keys(transports);
44
+  this.allowUpgrades = false !== opts.allowUpgrades;
45
+  this.allowRequest = opts.allowRequest;
46
+  this.cookie = false !== opts.cookie ? (opts.cookie || 'io') : false;
47
+
48
+  // initialize websocket server
49
+  if (~this.transports.indexOf('websocket')) {
50
+    this.ws = new WebSocketServer({ noServer: true, clientTracking: false });
51
+  }
52
+}
53
+
54
+/**
55
+ * Protocol errors mappings.
56
+ */
57
+
58
+Server.errors = {
59
+  UNKNOWN_TRANSPORT: 0,
60
+  UNKNOWN_SID: 1,
61
+  BAD_HANDSHAKE_METHOD: 2,
62
+  BAD_REQUEST: 3
63
+};
64
+
65
+Server.errorMessages = {
66
+  0: 'Transport unknown',
67
+  1: 'Session ID unknown',
68
+  2: 'Bad handshake method',
69
+  3: 'Bad request'
70
+};
71
+
72
+/**
73
+ * Inherits from EventEmitter.
74
+ */
75
+
76
+Server.prototype.__proto__ = EventEmitter.prototype;
77
+
78
+/**
79
+ * Hash of open clients.
80
+ *
81
+ * @api public
82
+ */
83
+
84
+Server.prototype.clients;
85
+
86
+/**
87
+ * Returns a list of available transports for upgrade given a certain transport.
88
+ *
89
+ * @return {Array}
90
+ * @api public
91
+ */
92
+
93
+Server.prototype.upgrades = function(transport){
94
+  if (!this.allowUpgrades) return [];
95
+  return transports[transport].upgradesTo || [];
96
+};
97
+
98
+/**
99
+ * Verifies a request.
100
+ *
101
+ * @param {http.ServerRequest}
102
+ * @return {Boolean} whether the request is valid
103
+ * @api private
104
+ */
105
+
106
+Server.prototype.verify = function(req, upgrade, fn){
107
+  // transport check
108
+  var transport = req._query.transport;
109
+  if (!~this.transports.indexOf(transport)) {
110
+    debug('unknown transport "%s"', transport);
111
+    return fn(Server.errors.UNKNOWN_TRANSPORT, false);
112
+  }
113
+
114
+  // sid check
115
+  var sid = req._query.sid;
116
+  if (sid) {
117
+    if (!this.clients.hasOwnProperty(sid))
118
+      return fn(Server.errors.UNKNOWN_SID, false);
119
+    if (!upgrade && this.clients[sid].transport.name !== transport) {
120
+      debug('bad request: unexpected transport without upgrade');
121
+      return fn(Server.errors.BAD_REQUEST, false);
122
+    }
123
+  } else {
124
+    // handshake is GET only
125
+    if ('GET' != req.method) return fn(Server.errors.BAD_HANDSHAKE_METHOD, false);
126
+    if (!this.allowRequest) return fn(null, true);
127
+    return this.allowRequest(req, fn);
128
+  }
129
+
130
+  fn(null, true);
131
+};
132
+
133
+/**
134
+ * Prepares a request by processing the query string.
135
+ *
136
+ * @api private
137
+ */
138
+
139
+Server.prototype.prepare = function(req){
140
+  // try to leverage pre-existing `req._query` (e.g: from connect)
141
+  if (!req._query) {
142
+    req._query = ~req.url.indexOf('?') ? qs.parse(parse(req.url).query) : {};
143
+  }
144
+};
145
+
146
+/**
147
+ * Closes all clients.
148
+ *
149
+ * @api public
150
+ */
151
+
152
+Server.prototype.close = function(){
153
+  debug('closing all open clients');
154
+  for (var i in this.clients) {
155
+    this.clients[i].close();
156
+  }
157
+  return this;
158
+};
159
+
160
+/**
161
+ * Handles an Engine.IO HTTP request.
162
+ *
163
+ * @param {http.ServerRequest} request
164
+ * @param {http.ServerResponse|http.OutgoingMessage} response
165
+ * @api public
166
+ */
167
+
168
+Server.prototype.handleRequest = function(req, res){
169
+  debug('handling "%s" http request "%s"', req.method, req.url);
170
+  this.prepare(req);
171
+  req.res = res;
172
+
173
+  var self = this;
174
+  this.verify(req, false, function(err, success) {
175
+    if (!success) {
176
+      sendErrorMessage(req, res, err);
177
+      return;
178
+    }
179
+
180
+    if (req._query.sid) {
181
+      debug('setting new request for existing client');
182
+      self.clients[req._query.sid].transport.onRequest(req);
183
+    } else {
184
+      self.handshake(req._query.transport, req);
185
+    }
186
+  });
187
+};
188
+
189
+/**
190
+ * Sends an Engine.IO Error Message
191
+ *
192
+ * @param {http.ServerResponse} response
193
+ * @param {code} error code
194
+ * @api private
195
+ */
196
+
197
+ function sendErrorMessage(req, res, code) {
198
+    var headers = { 'Content-Type': 'application/json' };
199
+
200
+    if (req.headers.origin) {
201
+      headers['Access-Control-Allow-Credentials'] = 'true';
202
+      headers['Access-Control-Allow-Origin'] = req.headers.origin;
203
+    } else {
204
+      headers['Access-Control-Allow-Origin'] = '*';
205
+    }
206
+    res.writeHead(400, headers);
207
+    res.end(JSON.stringify({
208
+      code: code,
209
+      message: Server.errorMessages[code]
210
+    }));
211
+ }
212
+
213
+/**
214
+ * Handshakes a new client.
215
+ *
216
+ * @param {String} transport name
217
+ * @param {Object} request object
218
+ * @api private
219
+ */
220
+
221
+Server.prototype.handshake = function(transport, req){
222
+  var id = base64id.generateId();
223
+
224
+  debug('handshaking client "%s"', id);
225
+
226
+  var transportName = transport;
227
+  try {
228
+    var transport = new transports[transport](req);
229
+    if ('polling' == transportName) {
230
+      transport.maxHttpBufferSize = this.maxHttpBufferSize;
231
+    }
232
+
233
+    if (req._query && req._query.b64) {
234
+      transport.supportsBinary = false;
235
+    } else {
236
+      transport.supportsBinary = true;
237
+    }
238
+  }
239
+  catch (e) {
240
+    sendErrorMessage(req, req.res, Server.errors.BAD_REQUEST);
241
+    return;
242
+  }
243
+  var socket = new Socket(id, this, transport, req);
244
+  var self = this;
245
+
246
+  if (false !== this.cookie) {
247
+    transport.on('headers', function(headers){
248
+      headers['Set-Cookie'] = self.cookie + '=' + id;
249
+    });
250
+  }
251
+
252
+  transport.onRequest(req);
253
+
254
+  this.clients[id] = socket;
255
+  this.clientsCount++;
256
+
257
+  socket.once('close', function(){
258
+    delete self.clients[id];
259
+    self.clientsCount--;
260
+  });
261
+
262
+  this.emit('connection', socket);
263
+};
264
+
265
+/**
266
+ * Handles an Engine.IO HTTP Upgrade.
267
+ *
268
+ * @api public
269
+ */
270
+
271
+Server.prototype.handleUpgrade = function(req, socket, upgradeHead){
272
+  this.prepare(req);
273
+
274
+  var self = this;
275
+  this.verify(req, true, function(err, success) {
276
+    if (!success) {
277
+      socket.end();
278
+      return;
279
+    }
280
+
281
+    var head = new Buffer(upgradeHead.length);
282
+    upgradeHead.copy(head);
283
+    upgradeHead = null;
284
+
285
+    // delegate to ws
286
+    self.ws.handleUpgrade(req, socket, head, function(conn){
287
+      self.onWebSocket(req, conn);
288
+    });
289
+  });
290
+};
291
+
292
+/**
293
+ * Called upon a ws.io connection.
294
+ *
295
+ * @param {ws.Socket} websocket
296
+ * @api private
297
+ */
298
+
299
+Server.prototype.onWebSocket = function(req, socket){
300
+  if (!transports[req._query.transport].prototype.handlesUpgrades) {
301
+    debug('transport doesnt handle upgraded requests');
302
+    socket.close();
303
+    return;
304
+  }
305
+
306
+  // get client id
307
+  var id = req._query.sid;
308
+
309
+  // keep a reference to the ws.Socket
310
+  req.websocket = socket;
311
+
312
+  if (id) {
313
+    if (!this.clients[id]) {
314
+      debug('upgrade attempt for closed client');
315
+      socket.close();
316
+    } else if (this.clients[id].upgraded) {
317
+      debug('transport had already been upgraded');
318
+      socket.close();
319
+    } else {
320
+      debug('upgrading existing transport');
321
+      var transport = new transports[req._query.transport](req);
322
+      if (req._query && req._query.b64) {
323
+        transport.supportsBinary = false;
324
+      } else {
325
+        transport.supportsBinary = true;
326
+      }
327
+      this.clients[id].maybeUpgrade(transport);
328
+    }
329
+  } else {
330
+    this.handshake(req._query.transport, req);
331
+  }
332
+};
333
+
334
+/**
335
+ * Captures upgrade requests for a http.Server.
336
+ *
337
+ * @param {http.Server} server
338
+ * @param {Object} options
339
+ * @api public
340
+ */
341
+
342
+Server.prototype.attach = function(server, options){
343
+  var self = this;
344
+  var options = options || {};
345
+  var path = (options.path || '/engine.io').replace(/\/$/, '');
346
+
347
+  var destroyUpgrade = (options.destroyUpgrade !== undefined) ? options.destroyUpgrade : true;
348
+  var destroyUpgradeTimeout = options.destroyUpgradeTimeout || 1000;
349
+
350
+  // normalize path
351
+  path += '/';
352
+
353
+  function check (req) {
354
+    return path == req.url.substr(0, path.length);
355
+  }
356
+
357
+  // cache and clean up listeners
358
+  var listeners = server.listeners('request').slice(0);
359
+  server.removeAllListeners('request');
360
+  server.on('close', self.close.bind(self));
361
+
362
+  // add request handler
363
+  server.on('request', function(req, res){
364
+    if (check(req)) {
365
+      debug('intercepting request for path "%s"', path);
366
+      self.handleRequest(req, res);
367
+    } else {
368
+      for (var i = 0, l = listeners.length; i < l; i++) {
369
+        listeners[i].call(server, req, res);
370
+      }
371
+    }
372
+  });
373
+
374
+  if(~self.transports.indexOf('websocket')) {
375
+    server.on('upgrade', function (req, socket, head) {
376
+      if (check(req)) {
377
+        self.handleUpgrade(req, socket, head);
378
+      } else if (false !== options.destroyUpgrade) {
379
+        // default node behavior is to disconnect when no handlers
380
+        // but by adding a handler, we prevent that
381
+        // and if no eio thing handles the upgrade
382
+        // then the socket needs to die!
383
+        setTimeout(function() {
384
+           if (socket.writable && socket.bytesWritten <= 0) {
385
+             return socket.end();
386
+           }
387
+        }, options.destroyUpgradeTimeout);
388
+      }
389
+    });
390
+  }
391
+};

+ 393
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/socket.js Прегледај датотеку

@@ -0,0 +1,393 @@
1
+/**
2
+ * Module dependencies.
3
+ */
4
+
5
+var EventEmitter = require('events').EventEmitter;
6
+var debug = require('debug')('engine:socket');
7
+
8
+/**
9
+ * Module exports.
10
+ */
11
+
12
+module.exports = Socket;
13
+
14
+/**
15
+ * Client class (abstract).
16
+ *
17
+ * @api private
18
+ */
19
+
20
+function Socket (id, server, transport, req) {
21
+  this.id = id;
22
+  this.server = server;
23
+  this.upgraded = false;
24
+  this.readyState = 'opening';
25
+  this.writeBuffer = [];
26
+  this.packetsFn = [];
27
+  this.sentCallbackFn = [];
28
+  this.request = req;
29
+
30
+  // Cache IP since it might not be in the req later
31
+  this.remoteAddress = req.connection.remoteAddress;
32
+
33
+  this.checkIntervalTimer = null;
34
+  this.upgradeTimeoutTimer = null;
35
+  this.pingTimeoutTimer = null;
36
+
37
+  this.setTransport(transport);
38
+  this.onOpen();
39
+}
40
+
41
+/**
42
+ * Inherits from EventEmitter.
43
+ */
44
+
45
+Socket.prototype.__proto__ = EventEmitter.prototype;
46
+
47
+/**
48
+ * Called upon transport considered open.
49
+ *
50
+ * @api private
51
+ */
52
+
53
+Socket.prototype.onOpen = function () {
54
+  this.readyState = 'open';
55
+
56
+  // sends an `open` packet
57
+  this.transport.sid = this.id;
58
+  this.sendPacket('open', JSON.stringify({
59
+      sid: this.id
60
+    , upgrades: this.getAvailableUpgrades()
61
+    , pingInterval: this.server.pingInterval
62
+    , pingTimeout: this.server.pingTimeout
63
+  }));
64
+
65
+  this.emit('open');
66
+  this.setPingTimeout();
67
+};
68
+
69
+/**
70
+ * Called upon transport packet.
71
+ *
72
+ * @param {Object} packet
73
+ * @api private
74
+ */
75
+
76
+Socket.prototype.onPacket = function (packet) {
77
+  if ('open' == this.readyState) {
78
+    // export packet event
79
+    debug('packet');
80
+    this.emit('packet', packet);
81
+
82
+    // Reset ping timeout on any packet, incoming data is a good sign of
83
+    // other side's liveness
84
+    this.setPingTimeout();
85
+
86
+    switch (packet.type) {
87
+
88
+      case 'ping':
89
+        debug('got ping');
90
+        this.sendPacket('pong');
91
+        this.emit('heartbeat');
92
+        break;
93
+
94
+      case 'error':
95
+        this.onClose('parse error');
96
+        break;
97
+
98
+      case 'message':
99
+        this.emit('data', packet.data);
100
+        this.emit('message', packet.data);
101
+        break;
102
+    }
103
+  } else {
104
+    debug('packet received with closed socket');
105
+  }
106
+};
107
+
108
+/**
109
+ * Called upon transport error.
110
+ *
111
+ * @param {Error} error object
112
+ * @api private
113
+ */
114
+
115
+Socket.prototype.onError = function (err) {
116
+  debug('transport error');
117
+  this.onClose('transport error', err);
118
+};
119
+
120
+/**
121
+ * Sets and resets ping timeout timer based on client pings.
122
+ *
123
+ * @api private
124
+ */
125
+
126
+Socket.prototype.setPingTimeout = function () {
127
+  var self = this;
128
+  clearTimeout(self.pingTimeoutTimer);
129
+  self.pingTimeoutTimer = setTimeout(function () {
130
+    self.onClose('ping timeout');
131
+  }, self.server.pingInterval + self.server.pingTimeout);
132
+};
133
+
134
+/**
135
+ * Attaches handlers for the given transport.
136
+ *
137
+ * @param {Transport} transport
138
+ * @api private
139
+ */
140
+
141
+Socket.prototype.setTransport = function (transport) {
142
+  this.transport = transport;
143
+  this.transport.once('error', this.onError.bind(this));
144
+  this.transport.on('packet', this.onPacket.bind(this));
145
+  this.transport.on('drain', this.flush.bind(this));
146
+  this.transport.once('close', this.onClose.bind(this, 'transport close'));
147
+  //this function will manage packet events (also message callbacks)
148
+  this.setupSendCallback();
149
+};
150
+
151
+/**
152
+ * Upgrades socket to the given transport
153
+ *
154
+ * @param {Transport} transport
155
+ * @api private
156
+ */
157
+
158
+Socket.prototype.maybeUpgrade = function (transport) {
159
+  debug('might upgrade socket transport from "%s" to "%s"'
160
+    , this.transport.name, transport.name);
161
+
162
+  var self = this;
163
+
164
+  // set transport upgrade timer
165
+  self.upgradeTimeoutTimer = setTimeout(function () {
166
+    debug('client did not complete upgrade - closing transport');
167
+    clearInterval(self.checkIntervalTimer);
168
+    self.checkIntervalTimer = null;
169
+    if ('open' == transport.readyState) {
170
+      transport.close();
171
+    }
172
+  }, this.server.upgradeTimeout);
173
+
174
+  function onPacket(packet){
175
+    if ('ping' == packet.type && 'probe' == packet.data) {
176
+      transport.send([{ type: 'pong', data: 'probe' }]);
177
+      clearInterval(self.checkIntervalTimer);
178
+      self.checkIntervalTimer = setInterval(check, 100);
179
+    } else if ('upgrade' == packet.type && self.readyState != 'closed') {
180
+      debug('got upgrade packet - upgrading');
181
+      self.upgraded = true;
182
+      self.clearTransport();
183
+      self.setTransport(transport);
184
+      self.emit('upgrade', transport);
185
+      self.setPingTimeout();
186
+      self.flush();
187
+      clearInterval(self.checkIntervalTimer);
188
+      self.checkIntervalTimer = null;
189
+      clearTimeout(self.upgradeTimeoutTimer);
190
+      transport.removeListener('packet', onPacket);
191
+      if (self.readyState == 'closing') {
192
+        transport.close(function () {
193
+          self.onClose('forced close');
194
+        });
195
+      }
196
+    } else {
197
+      transport.close();
198
+    }
199
+  }
200
+
201
+  // we force a polling cycle to ensure a fast upgrade
202
+  function check(){
203
+    if ('polling' == self.transport.name && self.transport.writable) {
204
+      debug('writing a noop packet to polling for fast upgrade');
205
+      self.transport.send([{ type: 'noop' }]);
206
+    }
207
+  }
208
+
209
+  transport.on('packet', onPacket);
210
+};
211
+
212
+/**
213
+ * Clears listeners and timers associated with current transport.
214
+ *
215
+ * @api private
216
+ */
217
+
218
+Socket.prototype.clearTransport = function () {
219
+  // silence further transport errors and prevent uncaught exceptions
220
+  this.transport.on('error', function(){
221
+    debug('error triggered by discarded transport');
222
+  });
223
+  clearTimeout(this.pingTimeoutTimer);
224
+};
225
+
226
+/**
227
+ * Called upon transport considered closed.
228
+ * Possible reasons: `ping timeout`, `client error`, `parse error`,
229
+ * `transport error`, `server close`, `transport close`
230
+ */
231
+
232
+Socket.prototype.onClose = function (reason, description) {
233
+  if ('closed' != this.readyState) {
234
+    clearTimeout(this.pingTimeoutTimer);
235
+    clearInterval(this.checkIntervalTimer);
236
+    this.checkIntervalTimer = null;
237
+    clearTimeout(this.upgradeTimeoutTimer);
238
+    var self = this;
239
+    // clean writeBuffer in next tick, so developers can still
240
+    // grab the writeBuffer on 'close' event
241
+    process.nextTick(function() {
242
+      self.writeBuffer = [];
243
+    });
244
+    this.packetsFn = [];
245
+    this.sentCallbackFn = [];
246
+    this.clearTransport();
247
+    this.readyState = 'closed';
248
+    this.emit('close', reason, description);
249
+  }
250
+};
251
+
252
+/**
253
+ * Setup and manage send callback
254
+ *
255
+ * @api private
256
+ */
257
+
258
+Socket.prototype.setupSendCallback = function () {
259
+  var self = this;
260
+  //the message was sent successfully, execute the callback
261
+  this.transport.on('drain', function() {
262
+    if (self.sentCallbackFn.length > 0) {
263
+      var seqFn = self.sentCallbackFn.splice(0,1)[0];
264
+      if ('function' == typeof seqFn) {
265
+        debug('executing send callback');
266
+        seqFn(self.transport);
267
+      } else if (Array.isArray(seqFn)) {
268
+        debug('executing batch send callback');
269
+        for (var l = seqFn.length, i = 0; i < l; i++) {
270
+          if ('function' == typeof seqFn[i]) {
271
+            seqFn[i](self.transport);
272
+          }
273
+        }
274
+      }
275
+    }
276
+  });
277
+};
278
+
279
+/**
280
+ * Sends a message packet.
281
+ *
282
+ * @param {String} message
283
+ * @param {Function} callback
284
+ * @return {Socket} for chaining
285
+ * @api public
286
+ */
287
+
288
+Socket.prototype.send =
289
+Socket.prototype.write = function(data, callback){
290
+  this.sendPacket('message', data, callback);
291
+  return this;
292
+};
293
+
294
+/**
295
+ * Sends a packet.
296
+ *
297
+ * @param {String} packet type
298
+ * @param {String} optional, data
299
+ * @api private
300
+ */
301
+
302
+Socket.prototype.sendPacket = function (type, data, callback) {
303
+  if ('closing' != this.readyState) {
304
+    debug('sending packet "%s" (%s)', type, data);
305
+
306
+    var packet = { type: type };
307
+    if (data) packet.data = data;
308
+
309
+    // exports packetCreate event
310
+    this.emit('packetCreate', packet);
311
+
312
+    this.writeBuffer.push(packet);
313
+
314
+    //add send callback to object
315
+    this.packetsFn.push(callback);
316
+
317
+    this.flush();
318
+  }
319
+};
320
+
321
+/**
322
+ * Attempts to flush the packets buffer.
323
+ *
324
+ * @api private
325
+ */
326
+
327
+Socket.prototype.flush = function () {
328
+  if ('closed' != this.readyState && this.transport.writable
329
+    && this.writeBuffer.length) {
330
+    debug('flushing buffer to transport');
331
+    this.emit('flush', this.writeBuffer);
332
+    this.server.emit('flush', this, this.writeBuffer);
333
+    var wbuf = this.writeBuffer;
334
+    this.writeBuffer = [];
335
+    if (!this.transport.supportsFraming) {
336
+      this.sentCallbackFn.push(this.packetsFn);
337
+    } else {
338
+      this.sentCallbackFn.push.apply(this.sentCallbackFn, this.packetsFn);
339
+    }
340
+    this.packetsFn = [];
341
+    this.transport.send(wbuf);
342
+    this.emit('drain');
343
+    this.server.emit('drain', this);
344
+  }
345
+};
346
+
347
+/**
348
+ * Get available upgrades for this socket.
349
+ *
350
+ * @api private
351
+ */
352
+
353
+Socket.prototype.getAvailableUpgrades = function () {
354
+  var availableUpgrades = [];
355
+  var allUpgrades = this.server.upgrades(this.transport.name);
356
+  for (var i = 0, l = allUpgrades.length; i < l; ++i) {
357
+    var upg = allUpgrades[i];
358
+    if (this.server.transports.indexOf(upg) != -1) {
359
+      availableUpgrades.push(upg);
360
+    }
361
+  }
362
+  return availableUpgrades;
363
+};
364
+
365
+/**
366
+ * Closes the socket and underlying transport.
367
+ *
368
+ * @return {Socket} for chaining
369
+ * @api public
370
+ */
371
+
372
+Socket.prototype.close = function () {
373
+  if ('open' != this.readyState) return;
374
+
375
+  this.readyState = 'closing';
376
+
377
+  if (this.writeBuffer.length) {
378
+    this.once('drain', this.closeTransport.bind(this));
379
+    return;
380
+  }
381
+
382
+  this.closeTransport();
383
+};
384
+
385
+/**
386
+ * Closes the underlying transport.
387
+ *
388
+ * @api private
389
+ */
390
+
391
+Socket.prototype.closeTransport = function () {
392
+  this.transport.close(this.onClose.bind(this, 'forced close'));
393
+};

+ 114
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transport.js Прегледај датотеку

@@ -0,0 +1,114 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var EventEmitter = require('events').EventEmitter
7
+  , parser = require('engine.io-parser')
8
+  , debug = require('debug')('engine:transport');
9
+
10
+/**
11
+ * Expose the constructor.
12
+ */
13
+
14
+module.exports = Transport;
15
+
16
+/**
17
+ * Noop function.
18
+ *
19
+ * @api private
20
+ */
21
+
22
+function noop () {};
23
+
24
+/**
25
+ * Transport constructor.
26
+ *
27
+ * @param {http.ServerRequest} request
28
+ * @api public
29
+ */
30
+
31
+function Transport (req) {
32
+  this.readyState = 'opening';
33
+};
34
+
35
+/**
36
+ * Inherits from EventEmitter.
37
+ */
38
+
39
+Transport.prototype.__proto__ = EventEmitter.prototype;
40
+
41
+/**
42
+ * Called with an incoming HTTP request.
43
+ *
44
+ * @param {http.ServerRequest} request
45
+ * @api private
46
+ */
47
+
48
+Transport.prototype.onRequest = function (req) {
49
+  debug('setting request');
50
+  this.req = req;
51
+};
52
+
53
+/**
54
+ * Closes the transport.
55
+ *
56
+ * @api private
57
+ */
58
+
59
+Transport.prototype.close = function (fn) {
60
+  this.readyState = 'closing';
61
+  this.doClose(fn || noop);
62
+};
63
+
64
+/**
65
+ * Called with a transport error.
66
+ *
67
+ * @param {String} message error
68
+ * @param {Object} error description
69
+ * @api private
70
+ */
71
+
72
+Transport.prototype.onError = function (msg, desc) {
73
+  if (this.listeners('error').length) {
74
+    var err = new Error(msg);
75
+    err.type = 'TransportError';
76
+    err.description = desc;
77
+    this.emit('error', err);
78
+  } else {
79
+    debug('ignored transport error %s (%s)', msg, desc);
80
+  }
81
+};
82
+
83
+/**
84
+ * Called with parsed out a packets from the data stream.
85
+ *
86
+ * @param {Object} packet
87
+ * @api private
88
+ */
89
+
90
+Transport.prototype.onPacket = function (packet) {
91
+  this.emit('packet', packet);
92
+};
93
+
94
+/**
95
+ * Called with the encoded packet data.
96
+ *
97
+ * @param {String} data
98
+ * @api private
99
+ */
100
+
101
+Transport.prototype.onData = function (data) {
102
+  this.onPacket(parser.decodePacket(data));
103
+};
104
+
105
+/**
106
+ * Called upon transport close.
107
+ *
108
+ * @api private
109
+ */
110
+
111
+Transport.prototype.onClose = function () {
112
+  this.readyState = 'closed';
113
+  this.emit('close');
114
+};

+ 36
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/index.js Прегледај датотеку

@@ -0,0 +1,36 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var XHR = require('./polling-xhr');
7
+var JSONP = require('./polling-jsonp');
8
+
9
+/**
10
+ * Export transports.
11
+ */
12
+
13
+module.exports = exports = {
14
+  polling: polling,
15
+  websocket: require('./websocket')
16
+};
17
+
18
+/**
19
+ * Export upgrades map.
20
+ */
21
+
22
+exports.polling.upgradesTo = ['websocket'];
23
+
24
+/**
25
+ * Polling polimorphic constructor.
26
+ *
27
+ * @api private
28
+ */
29
+
30
+function polling (req) {
31
+  if ('string' == typeof req._query.j) {
32
+    return new JSONP(req);
33
+  } else {
34
+    return new XHR(req);
35
+  }
36
+}

+ 108
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/polling-jsonp.js Прегледај датотеку

@@ -0,0 +1,108 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var Polling = require('./polling');
7
+var qs = require('querystring');
8
+var rDoubleSlashes = /\\\\n/g;
9
+var rSlashes = /(\\)?\\n/g;
10
+
11
+/**
12
+ * Module exports.
13
+ */
14
+
15
+module.exports = JSONP;
16
+
17
+/**
18
+ * JSON-P polling transport.
19
+ *
20
+ * @api public
21
+ */
22
+
23
+function JSONP (req) {
24
+  Polling.call(this, req);
25
+
26
+  this.head = '___eio[' + (req._query.j || '').replace(/[^0-9]/g, '') + '](';
27
+  this.foot = ');';
28
+};
29
+
30
+/**
31
+ * Inherits from Polling.
32
+ */
33
+
34
+JSONP.prototype.__proto__ = Polling.prototype;
35
+
36
+/**
37
+ * Handles incoming data.
38
+ * Due to a bug in \n handling by browsers, we expect a escaped string.
39
+ *
40
+ * @api private
41
+ */
42
+
43
+JSONP.prototype.onData = function (data) {
44
+  // we leverage the qs module so that we get built-in DoS protection
45
+  // and the fast alternative to decodeURIComponent
46
+  data = qs.parse(data).d;
47
+  if ('string' == typeof data) {
48
+    //client will send already escaped newlines as \\\\n and newlines as \\n
49
+    // \\n must be replaced with \n and \\\\n with \\n
50
+    data = data.replace(rSlashes, function(match, slashes) {
51
+      return slashes ? match : '\n';
52
+    });
53
+    Polling.prototype.onData.call(this, data.replace(rDoubleSlashes, '\\n'));
54
+  }
55
+};
56
+
57
+/**
58
+ * Performs the write.
59
+ *
60
+ * @api private
61
+ */
62
+
63
+JSONP.prototype.doWrite = function (data) {
64
+  // we must output valid javascript, not valid json
65
+  // see: http://timelessrepo.com/json-isnt-a-javascript-subset
66
+  var js = JSON.stringify(data)
67
+    .replace(/\u2028/g, '\\u2028')
68
+    .replace(/\u2029/g, '\\u2029');
69
+
70
+  // prepare response
71
+  data = this.head + js + this.foot;
72
+
73
+  // explicit UTF-8 is required for pages not served under utf
74
+  var headers = {
75
+    'Content-Type': 'text/javascript; charset=UTF-8',
76
+    'Content-Length': Buffer.byteLength(data)
77
+  };
78
+
79
+  // prevent XSS warnings on IE
80
+  // https://github.com/LearnBoost/socket.io/pull/1333
81
+  var ua = this.req.headers['user-agent'];
82
+  if (ua && (~ua.indexOf(';MSIE') || ~ua.indexOf('Trident/'))) {
83
+    headers['X-XSS-Protection'] = '0';
84
+  }
85
+
86
+  this.res.writeHead(200, this.headers(this.req, headers));
87
+  this.res.end(data);
88
+};
89
+
90
+/**
91
+ * Returns headers for a response.
92
+ *
93
+ * @param {http.ServerRequest} request
94
+ * @param {Object} extra headers
95
+ * @api private
96
+ */
97
+
98
+JSONP.prototype.headers = function (req, headers) {
99
+  headers = headers || {};
100
+
101
+  // disable XSS protection for IE
102
+  if (/MSIE 8\.0/.test(req.headers['user-agent'])) {
103
+    headers['X-XSS-Protection'] = '0';
104
+  }
105
+
106
+  this.emit('headers', headers);
107
+  return headers;
108
+};

+ 101
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/polling-xhr.js Прегледај датотеку

@@ -0,0 +1,101 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var Polling = require('./polling');
7
+var Transport = require('../transport');
8
+var debug = require('debug')('engine:polling-xhr');
9
+
10
+/**
11
+ * Module exports.
12
+ */
13
+
14
+module.exports = XHR;
15
+
16
+/**
17
+ * Ajax polling transport.
18
+ *
19
+ * @api public
20
+ */
21
+
22
+function XHR(req){
23
+  Polling.call(this, req);
24
+}
25
+
26
+/**
27
+ * Inherits from Polling.
28
+ */
29
+
30
+XHR.prototype.__proto__ = Polling.prototype;
31
+
32
+/**
33
+ * Overrides `onRequest` to handle `OPTIONS`..
34
+ *
35
+ * @param {http.ServerRequest}
36
+ * @api private
37
+ */
38
+
39
+XHR.prototype.onRequest = function (req) {
40
+  if ('OPTIONS' == req.method) {
41
+    var res = req.res;
42
+    var headers = this.headers(req);
43
+    headers['Access-Control-Allow-Headers'] = 'Content-Type';
44
+    res.writeHead(200, headers);
45
+    res.end();
46
+  } else {
47
+    Polling.prototype.onRequest.call(this, req);
48
+  }
49
+};
50
+
51
+/**
52
+ * Frames data prior to write.
53
+ *
54
+ * @api private
55
+ */
56
+
57
+XHR.prototype.doWrite = function(data){
58
+  // explicit UTF-8 is required for pages not served under utf
59
+  var isString = typeof data == 'string';
60
+  var contentType = isString
61
+    ? 'text/plain; charset=UTF-8'
62
+    : 'application/octet-stream';
63
+  var contentLength = '' + (isString ? Buffer.byteLength(data) : data.length);
64
+
65
+  var headers = {
66
+    'Content-Type': contentType,
67
+    'Content-Length': contentLength
68
+  };
69
+
70
+  // prevent XSS warnings on IE
71
+  // https://github.com/LearnBoost/socket.io/pull/1333
72
+  var ua = this.req.headers['user-agent'];
73
+  if (ua && (~ua.indexOf(';MSIE') || ~ua.indexOf('Trident/'))) {
74
+    headers['X-XSS-Protection'] = '0';
75
+  }
76
+
77
+  this.res.writeHead(200, this.headers(this.req, headers));
78
+  this.res.end(data);
79
+};
80
+
81
+/**
82
+ * Returns headers for a response.
83
+ *
84
+ * @param {http.ServerRequest} request
85
+ * @param {Object} extra headers
86
+ * @api private
87
+ */
88
+
89
+XHR.prototype.headers = function(req, headers){
90
+  headers = headers || {};
91
+
92
+  if (req.headers.origin) {
93
+    headers['Access-Control-Allow-Credentials'] = 'true';
94
+    headers['Access-Control-Allow-Origin'] = req.headers.origin;
95
+  } else {
96
+    headers['Access-Control-Allow-Origin'] = '*';
97
+  }
98
+
99
+  this.emit('headers', headers);
100
+  return headers;
101
+};

+ 279
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/polling.js Прегледај датотеку

@@ -0,0 +1,279 @@
1
+
2
+/**
3
+ * Module requirements.
4
+ */
5
+
6
+var Transport = require('../transport')
7
+  , parser = require('engine.io-parser')
8
+  , debug = require('debug')('engine:polling');
9
+
10
+/**
11
+ * Exports the constructor.
12
+ */
13
+
14
+module.exports = Polling;
15
+
16
+/**
17
+ * HTTP polling constructor.
18
+ *
19
+ * @api public.
20
+ */
21
+
22
+function Polling (req) {
23
+  Transport.call(this, req);
24
+}
25
+
26
+/**
27
+ * Inherits from Transport.
28
+ *
29
+ * @api public.
30
+ */
31
+
32
+Polling.prototype.__proto__ = Transport.prototype;
33
+
34
+/**
35
+ * Transport name
36
+ *
37
+ * @api public
38
+ */
39
+
40
+Polling.prototype.name = 'polling';
41
+
42
+/**
43
+ * Overrides onRequest.
44
+ *
45
+ * @param {http.ServerRequest}
46
+ * @api private
47
+ */
48
+
49
+Polling.prototype.onRequest = function (req) {
50
+  var res = req.res;
51
+
52
+  if ('GET' == req.method) {
53
+    this.onPollRequest(req, res);
54
+  } else if ('POST' == req.method) {
55
+    this.onDataRequest(req, res);
56
+  } else {
57
+    res.writeHead(500);
58
+    res.end();
59
+  }
60
+};
61
+
62
+/**
63
+ * The client sends a request awaiting for us to send data.
64
+ *
65
+ * @api private
66
+ */
67
+
68
+Polling.prototype.onPollRequest = function (req, res) {
69
+  if (this.req) {
70
+    debug('request overlap');
71
+    // assert: this.res, '.req and .res should be (un)set together'
72
+    this.onError('overlap from client');
73
+    res.writeHead(500);
74
+    return;
75
+  }
76
+
77
+  debug('setting request');
78
+
79
+  this.req = req;
80
+  this.res = res;
81
+
82
+  var self = this;
83
+
84
+  function onClose () {
85
+    self.onError('poll connection closed prematurely');
86
+  }
87
+
88
+  function cleanup () {
89
+    req.removeListener('close', onClose);
90
+    self.req = self.res = null;
91
+  }
92
+
93
+  req.cleanup = cleanup;
94
+  req.on('close', onClose);
95
+
96
+  this.writable = true;
97
+  this.emit('drain');
98
+
99
+  // if we're still writable but had a pending close, trigger an empty send
100
+  if (this.writable && this.shouldClose) {
101
+    debug('triggering empty send to append close packet');
102
+    this.send([{ type: 'noop' }]);
103
+  }
104
+};
105
+
106
+/**
107
+ * The client sends a request with data.
108
+ *
109
+ * @api private
110
+ */
111
+
112
+Polling.prototype.onDataRequest = function (req, res) {
113
+  if (this.dataReq) {
114
+    // assert: this.dataRes, '.dataReq and .dataRes should be (un)set together'
115
+    this.onError('data request overlap from client');
116
+    res.writeHead(500);
117
+    return;
118
+  }
119
+
120
+  var isBinary = 'application/octet-stream' == req.headers['content-type'];
121
+
122
+  this.dataReq = req;
123
+  this.dataRes = res;
124
+
125
+  var chunks = isBinary ? new Buffer(0) : '';
126
+  var self = this;
127
+
128
+  function cleanup () {
129
+    chunks = isBinary ? new Buffer(0) : '';
130
+    req.removeListener('data', onData);
131
+    req.removeListener('end', onEnd);
132
+    req.removeListener('close', onClose);
133
+    self.dataReq = self.dataRes = null;
134
+  }
135
+
136
+  function onClose () {
137
+    cleanup();
138
+    self.onError('data request connection closed prematurely');
139
+  }
140
+
141
+  function onData (data) {
142
+    var contentLength;
143
+    if (typeof data == 'string') {
144
+      chunks += data;
145
+      contentLength = Buffer.byteLength(chunks);
146
+    } else {
147
+      chunks = Buffer.concat([chunks, data]);
148
+      contentLength = chunks.length;
149
+    }
150
+
151
+    if (contentLength > self.maxHttpBufferSize) {
152
+      chunks = '';
153
+      req.connection.destroy();
154
+    }
155
+  }
156
+
157
+  function onEnd () {
158
+    self.onData(chunks);
159
+
160
+    var headers = {
161
+      // text/html is required instead of text/plain to avoid an
162
+      // unwanted download dialog on certain user-agents (GH-43)
163
+      'Content-Type': 'text/html',
164
+      'Content-Length': 2
165
+    };
166
+
167
+    // prevent XSS warnings on IE
168
+    // https://github.com/LearnBoost/socket.io/pull/1333
169
+    var ua = req.headers['user-agent'];
170
+    if (ua && (~ua.indexOf(';MSIE') || ~ua.indexOf('Trident/'))) {
171
+      headers['X-XSS-Protection'] = '0';
172
+    }
173
+
174
+    res.writeHead(200, self.headers(req, headers));
175
+    res.end('ok');
176
+    cleanup();
177
+  }
178
+
179
+  req.on('close', onClose);
180
+  req.on('data', onData);
181
+  req.on('end', onEnd);
182
+  if (!isBinary) req.setEncoding('utf8');
183
+};
184
+
185
+/**
186
+ * Processes the incoming data payload.
187
+ *
188
+ * @param {String} encoded payload
189
+ * @api private
190
+ */
191
+
192
+Polling.prototype.onData = function (data) {
193
+  debug('received "%s"', data);
194
+  var self = this;
195
+  var callback = function(packet) {
196
+    if ('close' == packet.type) {
197
+      debug('got xhr close packet');
198
+      self.onClose();
199
+      return false;
200
+    }
201
+
202
+    self.onPacket(packet);
203
+  };
204
+
205
+  parser.decodePayload(data, callback);
206
+};
207
+
208
+/**
209
+ * Overrides onClose.
210
+ *
211
+ * @api private
212
+ */
213
+
214
+Polling.prototype.onClose = function () {
215
+  if (this.writable) {
216
+    // close pending poll request
217
+    this.send([{ type: 'noop' }]);
218
+  }
219
+  Transport.prototype.onClose.call(this);
220
+};
221
+
222
+/**
223
+ * Writes a packet payload.
224
+ *
225
+ * @param {Object} packet
226
+ * @api private
227
+ */
228
+
229
+Polling.prototype.send = function (packets) {
230
+  if (this.shouldClose) {
231
+    debug('appending close packet to payload');
232
+    packets.push({ type: 'close' });
233
+    this.shouldClose();
234
+    this.shouldClose = null;
235
+  }
236
+
237
+  var self = this;
238
+  parser.encodePayload(packets, this.supportsBinary, function(data) {
239
+    self.write(data);
240
+  });
241
+};
242
+
243
+/**
244
+ * Writes data as response to poll request.
245
+ *
246
+ * @param {String} data
247
+ * @api private
248
+ */
249
+
250
+Polling.prototype.write = function (data) {
251
+  debug('writing "%s"', data);
252
+  this.doWrite(data);
253
+  this.req.cleanup();
254
+  this.writable = false;
255
+};
256
+
257
+/**
258
+ * Closes the transport.
259
+ *
260
+ * @api private
261
+ */
262
+
263
+Polling.prototype.doClose = function (fn) {
264
+  debug('closing');
265
+
266
+  if (this.dataReq) {
267
+    debug('aborting ongoing data request');
268
+    this.dataReq.destroy();
269
+  }
270
+
271
+  if (this.writable) {
272
+    debug('transport writable - closing right away');
273
+    this.send([{ type: 'close' }]);
274
+    fn();
275
+  } else {
276
+    debug('transport not writable - buffering orderly close');
277
+    this.shouldClose = fn;
278
+  }
279
+};

+ 110
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/lib/transports/websocket.js Прегледај датотеку

@@ -0,0 +1,110 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var Transport = require('../transport')
7
+  , parser = require('engine.io-parser')
8
+  , debug = require('debug')('engine:ws')
9
+
10
+/**
11
+ * Export the constructor.
12
+ */
13
+
14
+module.exports = WebSocket;
15
+
16
+/**
17
+ * WebSocket transport 
18
+ *
19
+ * @param {http.ServerRequest}
20
+ * @api public
21
+ */
22
+
23
+function WebSocket (req) {
24
+  Transport.call(this, req);
25
+  var self = this;
26
+  this.socket = req.websocket;
27
+  this.socket.on('message', this.onData.bind(this));
28
+  this.socket.once('close', this.onClose.bind(this));
29
+  this.socket.on('error', this.onError.bind(this));
30
+  this.socket.on('headers', function (headers) {
31
+    self.emit('headers', headers);
32
+  });
33
+  this.writable = true;
34
+};
35
+
36
+/**
37
+ * Inherits from Transport.
38
+ */
39
+
40
+WebSocket.prototype.__proto__ = Transport.prototype;
41
+
42
+/**
43
+ * Transport name
44
+ *
45
+ * @api public
46
+ */
47
+
48
+WebSocket.prototype.name = 'websocket';
49
+
50
+/**
51
+ * Advertise upgrade support.
52
+ *
53
+ * @api public
54
+ */
55
+
56
+WebSocket.prototype.handlesUpgrades = true;
57
+
58
+/**
59
+ * Advertise framing support.
60
+ *
61
+ * @api public
62
+ */
63
+
64
+WebSocket.prototype.supportsFraming = true;
65
+
66
+/**
67
+ * Processes the incoming data.
68
+ *
69
+ * @param {String} encoded packet
70
+ * @api private
71
+ */
72
+
73
+WebSocket.prototype.onData = function (data) {
74
+  debug('received "%s"', data);
75
+  Transport.prototype.onData.call(this, data);
76
+};
77
+
78
+/**
79
+ * Writes a packet payload.
80
+ *
81
+ * @param {Array} packets
82
+ * @api private
83
+ */
84
+
85
+WebSocket.prototype.send = function (packets) {
86
+  var self = this;
87
+  for (var i = 0, l = packets.length; i < l; i++) {
88
+    parser.encodePacket(packets[i], this.supportsBinary, function(data) {
89
+      debug('writing "%s"', data);
90
+      self.writable = false;
91
+      self.socket.send(data, function (err){
92
+        if (err) return self.onError('write error', err.stack);
93
+        self.writable = true;
94
+        self.emit('drain');
95
+      });
96
+    });
97
+  }
98
+};
99
+
100
+/**
101
+ * Closes the transport.
102
+ *
103
+ * @api private
104
+ */
105
+
106
+WebSocket.prototype.doClose = function (fn) {
107
+  debug('closing');
108
+  this.socket.close();
109
+  fn && fn();
110
+};

+ 3
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/.npmignore Прегледај датотеку

@@ -0,0 +1,3 @@
1
+support
2
+test
3
+examples

+ 18
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/README.md Прегледај датотеку

@@ -0,0 +1,18 @@
1
+base64id
2
+========
3
+
4
+Node.js module that generates a base64 id.
5
+
6
+Uses crypto.randomBytes when available, falls back to unsafe methods for node.js <= 0.4.
7
+
8
+To increase performance, random bytes are buffered to minimize the number of synchronous calls to crypto.randomBytes.
9
+
10
+## Installation
11
+
12
+   $ npm install mongoose
13
+
14
+## Usage
15
+
16
+   var base64id = require('base64id');
17
+
18
+   var id = base64id.generateId();

+ 103
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/lib/base64id.js Прегледај датотеку

@@ -0,0 +1,103 @@
1
+/*!
2
+ * base64id v0.1.0
3
+ */
4
+
5
+/**
6
+ * Module dependencies
7
+ */
8
+
9
+var crypto = require('crypto');
10
+
11
+/**
12
+ * Constructor
13
+ */
14
+
15
+var Base64Id = function() { };
16
+
17
+/**
18
+ * Get random bytes
19
+ *
20
+ * Uses a buffer if available, falls back to crypto.randomBytes
21
+ */
22
+
23
+Base64Id.prototype.getRandomBytes = function(bytes) {
24
+
25
+  var BUFFER_SIZE = 4096
26
+  var self = this;  
27
+  
28
+  bytes = bytes || 12;
29
+
30
+  if (bytes > BUFFER_SIZE) {
31
+    return crypto.randomBytes(bytes);
32
+  }
33
+  
34
+  var bytesInBuffer = parseInt(BUFFER_SIZE/bytes);
35
+  var threshold = parseInt(bytesInBuffer*0.85);
36
+
37
+  if (!threshold) {
38
+    return crypto.randomBytes(bytes);
39
+  }
40
+
41
+  if (this.bytesBufferIndex == null) {
42
+     this.bytesBufferIndex = -1;
43
+  }
44
+
45
+  if (this.bytesBufferIndex == bytesInBuffer) {
46
+    this.bytesBuffer = null;
47
+    this.bytesBufferIndex = -1;
48
+  }
49
+
50
+  // No buffered bytes available or index above threshold
51
+  if (this.bytesBufferIndex == -1 || this.bytesBufferIndex > threshold) {
52
+     
53
+    if (!this.isGeneratingBytes) {
54
+      this.isGeneratingBytes = true;
55
+      crypto.randomBytes(BUFFER_SIZE, function(err, bytes) {
56
+        self.bytesBuffer = bytes;
57
+        self.bytesBufferIndex = 0;
58
+        self.isGeneratingBytes = false;
59
+      }); 
60
+    }
61
+    
62
+    // Fall back to sync call when no buffered bytes are available
63
+    if (this.bytesBufferIndex == -1) {
64
+      return crypto.randomBytes(bytes);
65
+    }
66
+  }
67
+  
68
+  var result = this.bytesBuffer.slice(bytes*this.bytesBufferIndex, bytes*(this.bytesBufferIndex+1)); 
69
+  this.bytesBufferIndex++; 
70
+  
71
+  return result;
72
+}
73
+
74
+/**
75
+ * Generates a base64 id
76
+ *
77
+ * (Original version from socket.io <http://socket.io>)
78
+ */
79
+
80
+Base64Id.prototype.generateId = function () {
81
+  var rand = new Buffer(15); // multiple of 3 for base64
82
+  if (!rand.writeInt32BE) {
83
+    return Math.abs(Math.random() * Math.random() * Date.now() | 0).toString()
84
+      + Math.abs(Math.random() * Math.random() * Date.now() | 0).toString();
85
+  }
86
+  this.sequenceNumber = (this.sequenceNumber + 1) | 0;
87
+  rand.writeInt32BE(this.sequenceNumber, 11);
88
+  if (crypto.randomBytes) {
89
+    this.getRandomBytes(12).copy(rand);
90
+  } else {
91
+    // not secure for node 0.4
92
+    [0, 4, 8].forEach(function(i) {
93
+      rand.writeInt32BE(Math.random() * Math.pow(2, 32) | 0, i);
94
+    });
95
+  }
96
+  return rand.toString('base64').replace(/\//g, '_').replace(/\+/g, '-');
97
+};
98
+
99
+/**
100
+ * Export
101
+ */
102
+
103
+exports = module.exports = new Base64Id();

+ 47
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/base64id/package.json Прегледај датотеку

@@ -0,0 +1,47 @@
1
+{
2
+  "name": "base64id",
3
+  "version": "0.1.0",
4
+  "description": "Generates a base64 id",
5
+  "author": {
6
+    "name": "Kristian Faeldt",
7
+    "email": "faeldt_kristian@cyberagent.co.jp"
8
+  },
9
+  "repository": {
10
+    "type": "git",
11
+    "url": "git://github.com/faeldt/base64id.git"
12
+  },
13
+  "main": "./lib/base64id.js",
14
+  "engines": {
15
+    "node": ">= 0.4.0"
16
+  },
17
+  "_npmUser": {
18
+    "name": "faeldt_kristian",
19
+    "email": "faeldt_kristian@cyberagent.co.jp"
20
+  },
21
+  "_id": "base64id@0.1.0",
22
+  "dependencies": {},
23
+  "devDependencies": {},
24
+  "optionalDependencies": {},
25
+  "_engineSupported": true,
26
+  "_npmVersion": "1.1.16",
27
+  "_nodeVersion": "v0.6.15",
28
+  "_defaultsLoaded": true,
29
+  "dist": {
30
+    "shasum": "02ce0fdeee0cef4f40080e1e73e834f0b1bfce3f",
31
+    "tarball": "http://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz"
32
+  },
33
+  "maintainers": [
34
+    {
35
+      "name": "faeldt_kristian",
36
+      "email": "faeldt_kristian@cyberagent.co.jp"
37
+    }
38
+  ],
39
+  "directories": {},
40
+  "_shasum": "02ce0fdeee0cef4f40080e1e73e834f0b1bfce3f",
41
+  "_from": "base64id@0.1.0",
42
+  "_resolved": "https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz",
43
+  "bugs": {
44
+    "url": "https://github.com/faeldt/base64id/issues"
45
+  },
46
+  "readme": "ERROR: No README data found!"
47
+}

+ 3
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/.jshintrc Прегледај датотеку

@@ -0,0 +1,3 @@
1
+{
2
+  "laxbreak": true
3
+}

+ 6
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/.npmignore Прегледај датотеку

@@ -0,0 +1,6 @@
1
+support
2
+test
3
+examples
4
+example
5
+*.sock
6
+dist

+ 132
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/History.md Прегледај датотеку

@@ -0,0 +1,132 @@
1
+
2
+1.0.3 / 2014-07-09
3
+==================
4
+
5
+ * Add support for multiple wildcards in namespaces (#122, @seegno)
6
+ * browser: fix lint
7
+
8
+1.0.2 / 2014-06-10
9
+==================
10
+
11
+  * browser: update color palette (#113, @gscottolson)
12
+  * common: make console logging function configurable (#108, @timoxley)
13
+  * node: fix %o colors on old node <= 0.8.x
14
+  * Makefile: find node path using shell/which (#109, @timoxley)
15
+
16
+1.0.1 / 2014-06-06
17
+==================
18
+
19
+  * browser: use `removeItem()` to clear localStorage
20
+  * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
21
+  * package: add "contributors" section
22
+  * node: fix comment typo
23
+  * README: list authors
24
+
25
+1.0.0 / 2014-06-04
26
+==================
27
+
28
+  * make ms diff be global, not be scope
29
+  * debug: ignore empty strings in enable()
30
+  * node: make DEBUG_COLORS able to disable coloring
31
+  * *: export the `colors` array
32
+  * npmignore: don't publish the `dist` dir
33
+  * Makefile: refactor to use browserify
34
+  * package: add "browserify" as a dev dependency
35
+  * Readme: add Web Inspector Colors section
36
+  * node: reset terminal color for the debug content
37
+  * node: map "%o" to `util.inspect()`
38
+  * browser: map "%j" to `JSON.stringify()`
39
+  * debug: add custom "formatters"
40
+  * debug: use "ms" module for humanizing the diff
41
+  * Readme: add "bash" syntax highlighting
42
+  * browser: add Firebug color support
43
+  * browser: add colors for WebKit browsers
44
+  * node: apply log to `console`
45
+  * rewrite: abstract common logic for Node & browsers
46
+  * add .jshintrc file
47
+
48
+0.8.1 / 2014-04-14
49
+==================
50
+
51
+  * package: re-add the "component" section
52
+
53
+0.8.0 / 2014-03-30
54
+==================
55
+
56
+  * add `enable()` method for nodejs. Closes #27
57
+  * change from stderr to stdout
58
+  * remove unnecessary index.js file
59
+
60
+0.7.4 / 2013-11-13
61
+==================
62
+
63
+  * remove "browserify" key from package.json (fixes something in browserify)
64
+
65
+0.7.3 / 2013-10-30
66
+==================
67
+
68
+  * fix: catch localStorage security error when cookies are blocked (Chrome)
69
+  * add debug(err) support. Closes #46
70
+  * add .browser prop to package.json. Closes #42
71
+
72
+0.7.2 / 2013-02-06
73
+==================
74
+
75
+  * fix package.json
76
+  * fix: Mobile Safari (private mode) is broken with debug
77
+  * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
78
+
79
+0.7.1 / 2013-02-05
80
+==================
81
+
82
+  * add repository URL to package.json
83
+  * add DEBUG_COLORED to force colored output
84
+  * add browserify support
85
+  * fix component. Closes #24
86
+
87
+0.7.0 / 2012-05-04
88
+==================
89
+
90
+  * Added .component to package.json
91
+  * Added debug.component.js build
92
+
93
+0.6.0 / 2012-03-16
94
+==================
95
+
96
+  * Added support for "-" prefix in DEBUG [Vinay Pulim]
97
+  * Added `.enabled` flag to the node version [TooTallNate]
98
+
99
+0.5.0 / 2012-02-02
100
+==================
101
+
102
+  * Added: humanize diffs. Closes #8
103
+  * Added `debug.disable()` to the CS variant
104
+  * Removed padding. Closes #10
105
+  * Fixed: persist client-side variant again. Closes #9
106
+
107
+0.4.0 / 2012-02-01
108
+==================
109
+
110
+  * Added browser variant support for older browsers [TooTallNate]
111
+  * Added `debug.enable('project:*')` to browser variant [TooTallNate]
112
+  * Added padding to diff (moved it to the right)
113
+
114
+0.3.0 / 2012-01-26
115
+==================
116
+
117
+  * Added millisecond diff when isatty, otherwise UTC string
118
+
119
+0.2.0 / 2012-01-22
120
+==================
121
+
122
+  * Added wildcard support
123
+
124
+0.1.0 / 2011-12-02
125
+==================
126
+
127
+  * Added: remove colors unless stderr isatty [TooTallNate]
128
+
129
+0.0.1 / 2010-01-03
130
+==================
131
+
132
+  * Initial release

+ 33
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/Makefile Прегледај датотеку

@@ -0,0 +1,33 @@
1
+
2
+# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
3
+THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
4
+THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
5
+
6
+# BIN directory
7
+BIN := $(THIS_DIR)/node_modules/.bin
8
+
9
+# applications
10
+NODE ?= $(shell which node)
11
+NPM ?= $(NODE) $(shell which npm)
12
+BROWSERIFY ?= $(NODE) $(BIN)/browserify
13
+
14
+all: dist/debug.js
15
+
16
+install: node_modules
17
+
18
+clean:
19
+	@rm -rf node_modules dist
20
+
21
+dist:
22
+	@mkdir -p $@
23
+
24
+dist/debug.js: node_modules browser.js debug.js dist
25
+	@$(BROWSERIFY) \
26
+		--standalone debug \
27
+		. > $@
28
+
29
+node_modules: package.json
30
+	@NODE_ENV= $(NPM) install
31
+	@touch node_modules
32
+
33
+.PHONY: all install clean

+ 153
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/Readme.md Прегледај датотеку

@@ -0,0 +1,153 @@
1
+# debug
2
+
3
+  tiny node.js debugging utility modelled after node core's debugging technique.
4
+
5
+## Installation
6
+
7
+```bash
8
+$ npm install debug
9
+```
10
+
11
+## Usage
12
+
13
+ With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.
14
+
15
+Example _app.js_:
16
+
17
+```js
18
+var debug = require('debug')('http')
19
+  , http = require('http')
20
+  , name = 'My App';
21
+
22
+// fake app
23
+
24
+debug('booting %s', name);
25
+
26
+http.createServer(function(req, res){
27
+  debug(req.method + ' ' + req.url);
28
+  res.end('hello\n');
29
+}).listen(3000, function(){
30
+  debug('listening');
31
+});
32
+
33
+// fake worker of some kind
34
+
35
+require('./worker');
36
+```
37
+
38
+Example _worker.js_:
39
+
40
+```js
41
+var debug = require('debug')('worker');
42
+
43
+setInterval(function(){
44
+  debug('doing some work');
45
+}, 1000);
46
+```
47
+
48
+ The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
49
+
50
+  ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)
51
+
52
+  ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)
53
+
54
+## Millisecond diff
55
+
56
+  When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
57
+
58
+  ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)
59
+
60
+  When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
61
+
62
+  ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)
63
+
64
+## Conventions
65
+
66
+ If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
67
+
68
+## Wildcards
69
+
70
+  The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
71
+
72
+  You can also exclude specific debuggers by prefixing them with a "-" character.  For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
73
+
74
+## Browser support
75
+
76
+  Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`.
77
+
78
+```js
79
+a = debug('worker:a');
80
+b = debug('worker:b');
81
+
82
+setInterval(function(){
83
+  a('doing some work');
84
+}, 1000);
85
+
86
+setInterval(function(){
87
+  b('doing some work');
88
+}, 1200);
89
+```
90
+
91
+#### Web Inspector Colors
92
+
93
+  Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
94
+  option. These are WebKit web inspectors, and the Firebug plugin for Firefox.
95
+  Colored output looks something like:
96
+
97
+  ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png)
98
+
99
+### stderr vs stdout
100
+
101
+You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally:
102
+
103
+Example _stderr.js_:
104
+
105
+```js
106
+var debug = require('../');
107
+var log = debug('app:log');
108
+
109
+// by default console.log is used
110
+log('goes to stdout!');
111
+
112
+var error = debug('app:error');
113
+// set this namespace to log via console.error
114
+error.log = console.error.bind(console); // don't forget to bind to console!
115
+error('goes to stderr');
116
+log('still goes to stdout!');
117
+
118
+// set all output to go via console.warn
119
+// overrides all per-namespace log settings
120
+debug.log = console.warn.bind(console);
121
+log('now goes to stderr via console.warn');
122
+error('still goes to stderr, but via console.warn now');
123
+```
124
+
125
+## Authors
126
+
127
+ - TJ Holowaychuk
128
+ - Nathan Rajlich
129
+
130
+## License
131
+
132
+(The MIT License)
133
+
134
+Copyright (c) 2014 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
135
+
136
+Permission is hereby granted, free of charge, to any person obtaining
137
+a copy of this software and associated documentation files (the
138
+'Software'), to deal in the Software without restriction, including
139
+without limitation the rights to use, copy, modify, merge, publish,
140
+distribute, sublicense, and/or sell copies of the Software, and to
141
+permit persons to whom the Software is furnished to do so, subject to
142
+the following conditions:
143
+
144
+The above copyright notice and this permission notice shall be
145
+included in all copies or substantial portions of the Software.
146
+
147
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
148
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
149
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
150
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
151
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
152
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
153
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 144
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/browser.js Прегледај датотеку

@@ -0,0 +1,144 @@
1
+
2
+/**
3
+ * This is the web browser implementation of `debug()`.
4
+ *
5
+ * Expose `debug()` as the module.
6
+ */
7
+
8
+exports = module.exports = require('./debug');
9
+exports.log = log;
10
+exports.formatArgs = formatArgs;
11
+exports.save = save;
12
+exports.load = load;
13
+exports.useColors = useColors;
14
+
15
+/**
16
+ * Colors.
17
+ */
18
+
19
+exports.colors = [
20
+  'lightseagreen',
21
+  'forestgreen',
22
+  'goldenrod',
23
+  'dodgerblue',
24
+  'darkorchid',
25
+  'crimson'
26
+];
27
+
28
+/**
29
+ * Currently only WebKit-based Web Inspectors and the Firebug
30
+ * extension (*not* the built-in Firefox web inpector) are
31
+ * known to support "%c" CSS customizations.
32
+ *
33
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
34
+ */
35
+
36
+function useColors() {
37
+  // is webkit? http://stackoverflow.com/a/16459606/376773
38
+  return ('WebkitAppearance' in document.documentElement.style) ||
39
+    // is firebug? http://stackoverflow.com/a/398120/376773
40
+    (window.console && (console.firebug || (console.exception && console.table)));
41
+}
42
+
43
+/**
44
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
45
+ */
46
+
47
+exports.formatters.j = function(v) {
48
+  return JSON.stringify(v);
49
+};
50
+
51
+
52
+/**
53
+ * Colorize log arguments if enabled.
54
+ *
55
+ * @api public
56
+ */
57
+
58
+function formatArgs() {
59
+  var args = arguments;
60
+  var useColors = this.useColors;
61
+
62
+  args[0] = (useColors ? '%c' : '')
63
+    + this.namespace
64
+    + (useColors ? '%c ' : ' ')
65
+    + args[0]
66
+    + (useColors ? '%c ' : ' ')
67
+    + '+' + exports.humanize(this.diff);
68
+
69
+  if (!useColors) return args;
70
+
71
+  var c = 'color: ' + this.color;
72
+  args = [args[0], c, ''].concat(Array.prototype.slice.call(args, 1));
73
+
74
+  // the final "%c" is somewhat tricky, because there could be other
75
+  // arguments passed either before or after the %c, so we need to
76
+  // figure out the correct index to insert the CSS into
77
+  var index = 0;
78
+  var lastC = 0;
79
+  args[0].replace(/%[a-z%]/g, function(match) {
80
+    if ('%%' === match) return;
81
+    index++;
82
+    if ('%c' === match) {
83
+      // we only are interested in the *last* %c
84
+      // (the user may have provided their own)
85
+      lastC = index;
86
+    }
87
+  });
88
+
89
+  args.splice(lastC, 0, c);
90
+  return args;
91
+}
92
+
93
+/**
94
+ * Invokes `console.log()` when available.
95
+ * No-op when `console.log` is not a "function".
96
+ *
97
+ * @api public
98
+ */
99
+
100
+function log() {
101
+  // This hackery is required for IE8,
102
+  // where the `console.log` function doesn't have 'apply'
103
+  return 'object' == typeof console
104
+    && 'function' == typeof console.log
105
+    && Function.prototype.apply.call(console.log, console, arguments);
106
+}
107
+
108
+/**
109
+ * Save `namespaces`.
110
+ *
111
+ * @param {String} namespaces
112
+ * @api private
113
+ */
114
+
115
+function save(namespaces) {
116
+  try {
117
+    if (null == namespaces) {
118
+      localStorage.removeItem('debug');
119
+    } else {
120
+      localStorage.debug = namespaces;
121
+    }
122
+  } catch(e) {}
123
+}
124
+
125
+/**
126
+ * Load `namespaces`.
127
+ *
128
+ * @return {String} returns the previously persisted debug modes
129
+ * @api private
130
+ */
131
+
132
+function load() {
133
+  var r;
134
+  try {
135
+    r = localStorage.debug;
136
+  } catch(e) {}
137
+  return r;
138
+}
139
+
140
+/**
141
+ * Enable namespaces listed in `localStorage.debug` initially.
142
+ */
143
+
144
+exports.enable(load());

+ 19
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/component.json Прегледај датотеку

@@ -0,0 +1,19 @@
1
+{
2
+  "name": "debug",
3
+  "repo": "visionmedia/debug",
4
+  "description": "small debugging utility",
5
+  "version": "1.0.3",
6
+  "keywords": [
7
+    "debug",
8
+    "log",
9
+    "debugger"
10
+  ],
11
+  "main": "browser.js",
12
+  "scripts": [
13
+    "browser.js",
14
+    "debug.js"
15
+  ],
16
+  "dependencies": {
17
+    "guille/ms.js": "0.6.1"
18
+  }
19
+}

+ 197
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/debug.js Прегледај датотеку

@@ -0,0 +1,197 @@
1
+
2
+/**
3
+ * This is the common logic for both the Node.js and web browser
4
+ * implementations of `debug()`.
5
+ *
6
+ * Expose `debug()` as the module.
7
+ */
8
+
9
+exports = module.exports = debug;
10
+exports.coerce = coerce;
11
+exports.disable = disable;
12
+exports.enable = enable;
13
+exports.enabled = enabled;
14
+exports.humanize = require('ms');
15
+
16
+/**
17
+ * The currently active debug mode names, and names to skip.
18
+ */
19
+
20
+exports.names = [];
21
+exports.skips = [];
22
+
23
+/**
24
+ * Map of special "%n" handling functions, for the debug "format" argument.
25
+ *
26
+ * Valid key names are a single, lowercased letter, i.e. "n".
27
+ */
28
+
29
+exports.formatters = {};
30
+
31
+/**
32
+ * Previously assigned color.
33
+ */
34
+
35
+var prevColor = 0;
36
+
37
+/**
38
+ * Previous log timestamp.
39
+ */
40
+
41
+var prevTime;
42
+
43
+/**
44
+ * Select a color.
45
+ *
46
+ * @return {Number}
47
+ * @api private
48
+ */
49
+
50
+function selectColor() {
51
+  return exports.colors[prevColor++ % exports.colors.length];
52
+}
53
+
54
+/**
55
+ * Create a debugger with the given `namespace`.
56
+ *
57
+ * @param {String} namespace
58
+ * @return {Function}
59
+ * @api public
60
+ */
61
+
62
+function debug(namespace) {
63
+
64
+  // define the `disabled` version
65
+  function disabled() {
66
+  }
67
+  disabled.enabled = false;
68
+
69
+  // define the `enabled` version
70
+  function enabled() {
71
+
72
+    var self = enabled;
73
+
74
+    // set `diff` timestamp
75
+    var curr = +new Date();
76
+    var ms = curr - (prevTime || curr);
77
+    self.diff = ms;
78
+    self.prev = prevTime;
79
+    self.curr = curr;
80
+    prevTime = curr;
81
+
82
+    // add the `color` if not set
83
+    if (null == self.useColors) self.useColors = exports.useColors();
84
+    if (null == self.color && self.useColors) self.color = selectColor();
85
+
86
+    var args = Array.prototype.slice.call(arguments);
87
+
88
+    args[0] = exports.coerce(args[0]);
89
+
90
+    if ('string' !== typeof args[0]) {
91
+      // anything else let's inspect with %o
92
+      args = ['%o'].concat(args);
93
+    }
94
+
95
+    // apply any `formatters` transformations
96
+    var index = 0;
97
+    args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {
98
+      // if we encounter an escaped % then don't increase the array index
99
+      if (match === '%%') return match;
100
+      index++;
101
+      var formatter = exports.formatters[format];
102
+      if ('function' === typeof formatter) {
103
+        var val = args[index];
104
+        match = formatter.call(self, val);
105
+
106
+        // now we need to remove `args[index]` since it's inlined in the `format`
107
+        args.splice(index, 1);
108
+        index--;
109
+      }
110
+      return match;
111
+    });
112
+
113
+    if ('function' === typeof exports.formatArgs) {
114
+      args = exports.formatArgs.apply(self, args);
115
+    }
116
+    var logFn = exports.log || enabled.log || console.log.bind(console);
117
+    logFn.apply(self, args);
118
+  }
119
+  enabled.enabled = true;
120
+
121
+  var fn = exports.enabled(namespace) ? enabled : disabled;
122
+
123
+  fn.namespace = namespace;
124
+
125
+  return fn;
126
+}
127
+
128
+/**
129
+ * Enables a debug mode by namespaces. This can include modes
130
+ * separated by a colon and wildcards.
131
+ *
132
+ * @param {String} namespaces
133
+ * @api public
134
+ */
135
+
136
+function enable(namespaces) {
137
+  exports.save(namespaces);
138
+
139
+  var split = (namespaces || '').split(/[\s,]+/);
140
+  var len = split.length;
141
+
142
+  for (var i = 0; i < len; i++) {
143
+    if (!split[i]) continue; // ignore empty strings
144
+    namespaces = split[i].replace(/\*/g, '.*?');
145
+    if (namespaces[0] === '-') {
146
+      exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
147
+    } else {
148
+      exports.names.push(new RegExp('^' + namespaces + '$'));
149
+    }
150
+  }
151
+}
152
+
153
+/**
154
+ * Disable debug output.
155
+ *
156
+ * @api public
157
+ */
158
+
159
+function disable() {
160
+  exports.enable('');
161
+}
162
+
163
+/**
164
+ * Returns true if the given mode name is enabled, false otherwise.
165
+ *
166
+ * @param {String} name
167
+ * @return {Boolean}
168
+ * @api public
169
+ */
170
+
171
+function enabled(name) {
172
+  var i, len;
173
+  for (i = 0, len = exports.skips.length; i < len; i++) {
174
+    if (exports.skips[i].test(name)) {
175
+      return false;
176
+    }
177
+  }
178
+  for (i = 0, len = exports.names.length; i < len; i++) {
179
+    if (exports.names[i].test(name)) {
180
+      return true;
181
+    }
182
+  }
183
+  return false;
184
+}
185
+
186
+/**
187
+ * Coerce `val`.
188
+ *
189
+ * @param {Mixed} val
190
+ * @return {Mixed}
191
+ * @api private
192
+ */
193
+
194
+function coerce(val) {
195
+  if (val instanceof Error) return val.stack || val.message;
196
+  return val;
197
+}

+ 129
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node.js Прегледај датотеку

@@ -0,0 +1,129 @@
1
+
2
+/**
3
+ * Module dependencies.
4
+ */
5
+
6
+var tty = require('tty');
7
+var util = require('util');
8
+
9
+/**
10
+ * This is the Node.js implementation of `debug()`.
11
+ *
12
+ * Expose `debug()` as the module.
13
+ */
14
+
15
+exports = module.exports = require('./debug');
16
+exports.log = log;
17
+exports.formatArgs = formatArgs;
18
+exports.save = save;
19
+exports.load = load;
20
+exports.useColors = useColors;
21
+
22
+/**
23
+ * Colors.
24
+ */
25
+
26
+exports.colors = [6, 2, 3, 4, 5, 1];
27
+
28
+/**
29
+ * Is stdout a TTY? Colored output is enabled when `true`.
30
+ */
31
+
32
+function useColors() {
33
+  var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase();
34
+  if (0 === debugColors.length) {
35
+    return tty.isatty(1);
36
+  } else {
37
+    return '0' !== debugColors
38
+        && 'no' !== debugColors
39
+        && 'false' !== debugColors
40
+        && 'disabled' !== debugColors;
41
+  }
42
+}
43
+
44
+/**
45
+ * Map %o to `util.inspect()`, since Node doesn't do that out of the box.
46
+ */
47
+
48
+var inspect = (4 === util.inspect.length ?
49
+  // node <= 0.8.x
50
+  function (v, colors) {
51
+    return util.inspect(v, void 0, void 0, colors);
52
+  } :
53
+  // node > 0.8.x
54
+  function (v, colors) {
55
+    return util.inspect(v, { colors: colors });
56
+  }
57
+);
58
+
59
+exports.formatters.o = function(v) {
60
+  return inspect(v, this.useColors)
61
+    .replace(/\s*\n\s*/g, ' ');
62
+};
63
+
64
+/**
65
+ * Adds ANSI color escape codes if enabled.
66
+ *
67
+ * @api public
68
+ */
69
+
70
+function formatArgs() {
71
+  var args = arguments;
72
+  var useColors = this.useColors;
73
+  var name = this.namespace;
74
+
75
+  if (useColors) {
76
+    var c = this.color;
77
+
78
+    args[0] = '  \u001b[9' + c + 'm' + name + ' '
79
+      + '\u001b[0m'
80
+      + args[0] + '\u001b[3' + c + 'm'
81
+      + ' +' + exports.humanize(this.diff) + '\u001b[0m';
82
+  } else {
83
+    args[0] = new Date().toUTCString()
84
+      + ' ' + name + ' ' + args[0];
85
+  }
86
+  return args;
87
+}
88
+
89
+/**
90
+ * Invokes `console.log()` with the specified arguments.
91
+ */
92
+
93
+function log() {
94
+  return console.log.apply(console, arguments);
95
+}
96
+
97
+/**
98
+ * Save `namespaces`.
99
+ *
100
+ * @param {String} namespaces
101
+ * @api private
102
+ */
103
+
104
+function save(namespaces) {
105
+  if (null == namespaces) {
106
+    // If you set a process.env field to null or undefined, it gets cast to the
107
+    // string 'null' or 'undefined'. Just delete instead.
108
+    delete process.env.DEBUG;
109
+  } else {
110
+    process.env.DEBUG = namespaces;
111
+  }
112
+}
113
+
114
+/**
115
+ * Load `namespaces`.
116
+ *
117
+ * @return {String} returns the previously persisted debug modes
118
+ * @api private
119
+ */
120
+
121
+function load() {
122
+  return process.env.DEBUG;
123
+}
124
+
125
+/**
126
+ * Enable namespaces listed in `process.env.DEBUG` initially.
127
+ */
128
+
129
+exports.enable(load());

+ 5
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/.npmignore Прегледај датотеку

@@ -0,0 +1,5 @@
1
+node_modules
2
+test
3
+History.md
4
+Makefile
5
+component.json

+ 33
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/README.md Прегледај датотеку

@@ -0,0 +1,33 @@
1
+# ms.js: miliseconds conversion utility
2
+
3
+```js
4
+ms('1d')      // 86400000
5
+ms('10h')     // 36000000
6
+ms('2h')      // 7200000
7
+ms('1m')      // 60000
8
+ms('5s')      // 5000
9
+ms('100')     // 100
10
+```
11
+
12
+```js
13
+ms(60000)             // "1m"
14
+ms(2 * 60000)         // "2m"
15
+ms(ms('10 hours'))    // "10h"
16
+```
17
+
18
+```js
19
+ms(60000, { long: true })             // "1 minute"
20
+ms(2 * 60000, { long: true })         // "2 minutes"
21
+ms(ms('10 hours', { long: true }))    // "10 hours"
22
+```
23
+
24
+- Node/Browser compatible. Published as `ms` in NPM.
25
+- If a number is supplied to `ms`, a string with a unit is returned.
26
+- If a string that contains the number is supplied, it returns it as
27
+a number (e.g: it returns `100` for `'100'`).
28
+- If you pass a string with a number and a valid unit, the number of
29
+equivalent ms is returned.
30
+
31
+## License
32
+
33
+MIT

+ 111
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/index.js Прегледај датотеку

@@ -0,0 +1,111 @@
1
+/**
2
+ * Helpers.
3
+ */
4
+
5
+var s = 1000;
6
+var m = s * 60;
7
+var h = m * 60;
8
+var d = h * 24;
9
+var y = d * 365.25;
10
+
11
+/**
12
+ * Parse or format the given `val`.
13
+ *
14
+ * Options:
15
+ *
16
+ *  - `long` verbose formatting [false]
17
+ *
18
+ * @param {String|Number} val
19
+ * @param {Object} options
20
+ * @return {String|Number}
21
+ * @api public
22
+ */
23
+
24
+module.exports = function(val, options){
25
+  options = options || {};
26
+  if ('string' == typeof val) return parse(val);
27
+  return options.long
28
+    ? long(val)
29
+    : short(val);
30
+};
31
+
32
+/**
33
+ * Parse the given `str` and return milliseconds.
34
+ *
35
+ * @param {String} str
36
+ * @return {Number}
37
+ * @api private
38
+ */
39
+
40
+function parse(str) {
41
+  var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
42
+  if (!match) return;
43
+  var n = parseFloat(match[1]);
44
+  var type = (match[2] || 'ms').toLowerCase();
45
+  switch (type) {
46
+    case 'years':
47
+    case 'year':
48
+    case 'y':
49
+      return n * y;
50
+    case 'days':
51
+    case 'day':
52
+    case 'd':
53
+      return n * d;
54
+    case 'hours':
55
+    case 'hour':
56
+    case 'h':
57
+      return n * h;
58
+    case 'minutes':
59
+    case 'minute':
60
+    case 'm':
61
+      return n * m;
62
+    case 'seconds':
63
+    case 'second':
64
+    case 's':
65
+      return n * s;
66
+    case 'ms':
67
+      return n;
68
+  }
69
+}
70
+
71
+/**
72
+ * Short format for `ms`.
73
+ *
74
+ * @param {Number} ms
75
+ * @return {String}
76
+ * @api private
77
+ */
78
+
79
+function short(ms) {
80
+  if (ms >= d) return Math.round(ms / d) + 'd';
81
+  if (ms >= h) return Math.round(ms / h) + 'h';
82
+  if (ms >= m) return Math.round(ms / m) + 'm';
83
+  if (ms >= s) return Math.round(ms / s) + 's';
84
+  return ms + 'ms';
85
+}
86
+
87
+/**
88
+ * Long format for `ms`.
89
+ *
90
+ * @param {Number} ms
91
+ * @return {String}
92
+ * @api private
93
+ */
94
+
95
+function long(ms) {
96
+  return plural(ms, d, 'day')
97
+    || plural(ms, h, 'hour')
98
+    || plural(ms, m, 'minute')
99
+    || plural(ms, s, 'second')
100
+    || ms + ' ms';
101
+}
102
+
103
+/**
104
+ * Pluralization helper.
105
+ */
106
+
107
+function plural(ms, n, name) {
108
+  if (ms < n) return;
109
+  if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
110
+  return Math.ceil(ms / n) + ' ' + name + 's';
111
+}

+ 45
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/node_modules/ms/package.json Прегледај датотеку

@@ -0,0 +1,45 @@
1
+{
2
+  "name": "ms",
3
+  "version": "0.6.2",
4
+  "description": "Tiny ms conversion utility",
5
+  "repository": {
6
+    "type": "git",
7
+    "url": "git://github.com/guille/ms.js.git"
8
+  },
9
+  "main": "./index",
10
+  "devDependencies": {
11
+    "mocha": "*",
12
+    "expect.js": "*",
13
+    "serve": "*"
14
+  },
15
+  "component": {
16
+    "scripts": {
17
+      "ms/index.js": "index.js"
18
+    }
19
+  },
20
+  "bugs": {
21
+    "url": "https://github.com/guille/ms.js/issues"
22
+  },
23
+  "_id": "ms@0.6.2",
24
+  "dist": {
25
+    "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c",
26
+    "tarball": "http://registry.npmjs.org/ms/-/ms-0.6.2.tgz"
27
+  },
28
+  "_from": "ms@0.6.2",
29
+  "_npmVersion": "1.2.30",
30
+  "_npmUser": {
31
+    "name": "rauchg",
32
+    "email": "rauchg@gmail.com"
33
+  },
34
+  "maintainers": [
35
+    {
36
+      "name": "rauchg",
37
+      "email": "rauchg@gmail.com"
38
+    }
39
+  ],
40
+  "directories": {},
41
+  "_shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c",
42
+  "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz",
43
+  "readme": "ERROR: No README data found!",
44
+  "scripts": {}
45
+}

+ 71
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/debug/package.json Прегледај датотеку

@@ -0,0 +1,71 @@
1
+{
2
+  "name": "debug",
3
+  "version": "1.0.3",
4
+  "repository": {
5
+    "type": "git",
6
+    "url": "git://github.com/visionmedia/debug.git"
7
+  },
8
+  "description": "small debugging utility",
9
+  "keywords": [
10
+    "debug",
11
+    "log",
12
+    "debugger"
13
+  ],
14
+  "author": {
15
+    "name": "TJ Holowaychuk",
16
+    "email": "tj@vision-media.ca"
17
+  },
18
+  "contributors": [
19
+    {
20
+      "name": "Nathan Rajlich",
21
+      "email": "nathan@tootallnate.net",
22
+      "url": "http://n8.io"
23
+    }
24
+  ],
25
+  "dependencies": {
26
+    "ms": "0.6.2"
27
+  },
28
+  "devDependencies": {
29
+    "browserify": "4.1.6",
30
+    "mocha": "*"
31
+  },
32
+  "main": "./node.js",
33
+  "browser": "./browser.js",
34
+  "component": {
35
+    "scripts": {
36
+      "debug/index.js": "browser.js",
37
+      "debug/debug.js": "debug.js"
38
+    }
39
+  },
40
+  "gitHead": "93c759961d53ad7f06a1892a8dd0bf4be4a7b9df",
41
+  "bugs": {
42
+    "url": "https://github.com/visionmedia/debug/issues"
43
+  },
44
+  "homepage": "https://github.com/visionmedia/debug",
45
+  "_id": "debug@1.0.3",
46
+  "scripts": {},
47
+  "_shasum": "fc8c6b2d6002804b4081c0208e0f6460ba1fa3e4",
48
+  "_from": "debug@1.0.3",
49
+  "_npmVersion": "1.4.14",
50
+  "_npmUser": {
51
+    "name": "tootallnate",
52
+    "email": "nathan@tootallnate.net"
53
+  },
54
+  "maintainers": [
55
+    {
56
+      "name": "tjholowaychuk",
57
+      "email": "tj@vision-media.ca"
58
+    },
59
+    {
60
+      "name": "tootallnate",
61
+      "email": "nathan@tootallnate.net"
62
+    }
63
+  ],
64
+  "dist": {
65
+    "shasum": "fc8c6b2d6002804b4081c0208e0f6460ba1fa3e4",
66
+    "tarball": "http://registry.npmjs.org/debug/-/debug-1.0.3.tgz"
67
+  },
68
+  "directories": {},
69
+  "_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.3.tgz",
70
+  "readme": "ERROR: No README data found!"
71
+}

+ 17
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.npmignore Прегледај датотеку

@@ -0,0 +1,17 @@
1
+lib-cov
2
+*.seed
3
+*.log
4
+*.csv
5
+*.dat
6
+*.out
7
+*.pid
8
+*.gz
9
+
10
+pids
11
+logs
12
+results
13
+
14
+npm-debug.log
15
+node_modules/*
16
+
17
+test

+ 45
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.travis.yml Прегледај датотеку

@@ -0,0 +1,45 @@
1
+language: node_js
2
+node_js:
3
+- 0.10
4
+notifications:
5
+  irc: irc.freenode.org##socket.io
6
+env:
7
+  global:
8
+  - secure: ZS6AzV1n1K1exomhZoK0SorBHEy4/7/qdk1p5/dm0tQdStSVwRDJyQk5wUIgJFsJaVlN8O/MH8LBkiLlalohR/DdE2ZtkNJqfMnetE/ZqPX7r8mzwDasnHJNJnKWJlBVqOpy7hciiPV2yZGIJoe2OQfwWxFEcLJ6NGOXCEkyLAg=
9
+  - secure: hcqk+nIqzrwJSQs+5T1sKN4YiCghQdP849RjH64bb7Ayslh+o0DmihTE3Wl+cCWFcRBvwBJdmDV2gJpsVcODTc2VdOrJnv8ezfQ8zvAyDZFYxno47PtbjQUi0By2wBPp6zlfigcnXxQ2z6997EDRvsI4VgQVqKsGLot4cMU9oz0=
10
+matrix:
11
+  include:
12
+  - node_js: '0.10'
13
+    env: BROWSER_NAME=chrome BROWSER_VERSION=latest
14
+  - node_js: '0.10'
15
+    env: BROWSER_NAME=safari BROWSER_VERSION=latest
16
+  - node_js: '0.10'
17
+    env: BROWSER_NAME=ie BROWSER_VERSION=6
18
+  - node_js: '0.10'
19
+    env: BROWSER_NAME=ie BROWSER_VERSION=7
20
+  - node_js: '0.10'
21
+    env: BROWSER_NAME=ie BROWSER_VERSION=8
22
+  - node_js: '0.10'
23
+    env: BROWSER_NAME=ie BROWSER_VERSION=9
24
+  - node_js: '0.10'
25
+    env: BROWSER_NAME=ie BROWSER_VERSION=10 BROWSER_PLATFORM="Windows 2012"
26
+  - node_js: '0.10'
27
+    env: BROWSER_NAME=ie BROWSER_VERSION=latest BROWSER_PLATFORM="Windows 2012"
28
+  - node_js: '0.10'
29
+    env: BROWSER_NAME=iphone BROWSER_VERSION=4.3
30
+  - node_js: '0.10'
31
+    env: BROWSER_NAME=iphone BROWSER_VERSION=5.1
32
+  - node_js: '0.10'
33
+    env: BROWSER_NAME=iphone BROWSER_VERSION=6.1
34
+  - node_js: '0.10'
35
+    env: BROWSER_NAME=iphone BROWSER_VERSION=7.1
36
+  - node_js: '0.10'
37
+    env: BROWSER_NAME=android BROWSER_VERSION=4.0
38
+  - node_js: '0.10'
39
+    env: BROWSER_NAME=android BROWSER_VERSION=4.1
40
+  - node_js: '0.10'
41
+    env: BROWSER_NAME=android BROWSER_VERSION=4.2
42
+  - node_js: '0.10'
43
+    env: BROWSER_NAME=android BROWSER_VERSION=4.3
44
+  - node_js: '0.10'
45
+    env: BROWSER_NAME=android BROWSER_VERSION=4.4

+ 18
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/.zuul.yml Прегледај датотеку

@@ -0,0 +1,18 @@
1
+ui: mocha-bdd
2
+browsers: 
3
+  - name: chrome
4
+    version: 29..latest
5
+  - name: firefox
6
+    version: latest
7
+  - name: safari
8
+    version: latest
9
+  - name: ie
10
+    version: 10
11
+    platform: Windows 2012
12
+  - name: ie
13
+    version: 9
14
+    version: [6..9, latest]
15
+  - name: iphone
16
+    version: oldest..latest
17
+  - name: android
18
+    version: latest

+ 100
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/History.md Прегледај датотеку

@@ -0,0 +1,100 @@
1
+
2
+1.2.1 / 2015-01-17
3
+==================
4
+
5
+ * pass has-binary result to encodePacket [rase-]
6
+ * Fix parse error [rase-]
7
+
8
+1.2.0 / 2015-01-11
9
+==================
10
+
11
+ * fix return type for decodePacket
12
+ * README fixes
13
+ * use travis matrix for better test runs
14
+ * encode into binary only if needed
15
+ * add test cases for base64 object encoding.
16
+ * add encodeBase64Object to encoder for browser
17
+ * avoid sending Blobs on PhantomJS (as on Android)
18
+ * test that utf8 encoding is not on by default but can be switched on manually
19
+
20
+1.1.0 / 2014-07-16
21
+==================
22
+
23
+ * make utf8 encoding/decoding optional
24
+
25
+1.0.8 / 2014-07-16
26
+==================
27
+
28
+ * adjust protocol revision
29
+ * handle invalid utf8 errors gracefully
30
+ * fix memory leak on browser
31
+
32
+1.0.7 / 2014-06-24
33
+==================
34
+
35
+ * fix decodePayloadAsBinary memory leak [christophwitzko]
36
+ * README improvements
37
+
38
+1.0.6 / 2014-05-30
39
+==================
40
+
41
+ * utf8 fixes when using binary encoding [nkzawa]
42
+
43
+1.0.5 / 2014-05-06
44
+==================
45
+
46
+ * fix range error
47
+
48
+1.0.4 / 2014-04-13
49
+==================
50
+
51
+ * fix `encodePayloadAsBinary` method encodes packets to base64
52
+
53
+1.0.3 / 2014-04-10
54
+==================
55
+
56
+ * Fix length calculation when encoding as binary [binlain]
57
+
58
+1.0.2 / 2014-03-16
59
+==================
60
+
61
+ * fix binary for android due to a bug in Blob XHR2 implementation [Rase-]
62
+
63
+1.0.1 / 2014-03-06
64
+==================
65
+
66
+ * implement `blob` module to simplify code
67
+ * bump `arraybuffer.slice`
68
+ * style fixes
69
+
70
+1.0.0 / 2014-02-18
71
+==================
72
+
73
+ * parser: added binary encoding [Rase-]
74
+ * parser: switched to an async interface [Rase-]
75
+
76
+0.3.0 / 2013-03-16
77
+==================
78
+
79
+  * parser: if callback returns `false` ignore rest of payload
80
+  * test: fixed all broken tests
81
+
82
+0.2.1 / 2013-03-16
83
+==================
84
+
85
+  * added protocol version to index.js [albertyfwu]
86
+
87
+0.2.0 / 2013-02-26
88
+==================
89
+
90
+  * Changed `decodePayload` to use a callback instead of returning an array [sweetieSong, albertyfwu]
91
+
92
+0.1.1 / 2013-01-26
93
+==================
94
+
95
+  * package.json fixes
96
+
97
+0.1.0 / 2013-01-19
98
+==================
99
+
100
+  * Initial release

+ 22
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/LICENSE Прегледај датотеку

@@ -0,0 +1,22 @@
1
+(The MIT License)
2
+
3
+Copyright (c) 2014 Automattic <dev@cloudup.com>
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining
6
+a copy of this software and associated documentation files (the
7
+'Software'), to deal in the Software without restriction, including
8
+without limitation the rights to use, copy, modify, merge, publish,
9
+distribute, sublicense, and/or sell copies of the Software, and to
10
+permit persons to whom the Software is furnished to do so, subject to
11
+the following conditions:
12
+
13
+The above copyright notice and this permission notice shall be
14
+included in all copies or substantial portions of the Software.
15
+
16
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 26
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Makefile Прегледај датотеку

@@ -0,0 +1,26 @@
1
+
2
+REPORTER = dot
3
+
4
+test:
5
+	@if [ "x$(BROWSER_NAME)" = "x" ]; then make test-node; else make test-zuul; fi
6
+
7
+test-node:
8
+	@./node_modules/.bin/mocha \
9
+		--reporter $(REPORTER) \
10
+		test/index.js
11
+
12
+test-zuul:
13
+	@if [ "x$(BROWSER_PLATFORM)" = "x" ]; then \
14
+		./node_modules/zuul/bin/zuul \
15
+		--browser-name $(BROWSER_NAME) \
16
+		--browser-version $(BROWSER_VERSION) \
17
+		test/index.js; \
18
+		else \
19
+		./node_modules/zuul/bin/zuul \
20
+		--browser-name $(BROWSER_NAME) \
21
+		--browser-version $(BROWSER_VERSION) \
22
+		--browser-platform "$(BROWSER_PLATFORM)" \
23
+		test/index.js; \
24
+	fi
25
+
26
+.PHONY: test

+ 202
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/Readme.md Прегледај датотеку

@@ -0,0 +1,202 @@
1
+
2
+# engine.io-parser
3
+
4
+[![Build Status](https://secure.travis-ci.org/Automattic/engine.io-parser.svg)](http://travis-ci.org/Automattic/engine.io-parser)
5
+[![NPM version](https://badge.fury.io/js/engine.io-parser.svg)](http://badge.fury.io/js/engine.io-parser)
6
+
7
+This is the JavaScript parser for the engine.io protocol encoding,
8
+shared by both
9
+[engine.io-client](https://github.com/Automattic/engine.io-client) and
10
+[engine.io](https://github.com/Automattic/engine.io).
11
+
12
+## How to use
13
+
14
+### Standalone
15
+
16
+The parser can encode/decode packets, payloads, and payloads as binary
17
+with the following methods: `encodePacket`, `decodePacket`, `encodePayload`,
18
+`decodePayload`, `encodePayloadAsBinary`, `decodePayloadAsBinary`.
19
+
20
+The browser-side parser also includes `encodePayloadAsArrayBuffer` and `encodePayloadAsBlob`.
21
+
22
+Example:
23
+
24
+```js
25
+var parser = require('engine.io-parser');
26
+
27
+var data = new Buffer(5);
28
+for (var i = 0; i < data.length; i++) { data[i] = i; }
29
+
30
+parser.encodePacket({ type: 'message', data: data }, function(encoded) {
31
+  var decodedData = parser.decodePacket(encoded); // { type: 'message', data: data }
32
+});
33
+```
34
+
35
+### With browserify
36
+
37
+Engine.IO Parser is a commonjs module, which means you can include it by using
38
+`require` on the browser and package using [browserify](http://browserify.org/):
39
+
40
+1. install the parser package
41
+
42
+    ```shell
43
+    npm install engine.io-parser
44
+    ```
45
+
46
+1. write your app code
47
+
48
+    ```js
49
+    var parser = require('engine.io-parser');
50
+
51
+    var testBuffer = new Int8Array(10);
52
+    for (var i = 0; i < testBuffer.length; i++) testBuffer[i] = i;
53
+
54
+    var packets = [{ type: 'message', data: testBuffer.buffer }, { type: 'message', data: 'hello' }];
55
+
56
+    parser.encodePayload(packets, function(encoded) {
57
+      parser.decodePayload(encoded,
58
+        function(packet, index, total) {
59
+          var isLast = index + 1 == total;
60
+          if (!isLast) {
61
+            var buffer = new Int8Array(packet.data); // testBuffer
62
+          } else {
63
+            var message = packet.data; // 'hello'
64
+          }
65
+        });
66
+    });
67
+    ```
68
+
69
+1. build your app bundle
70
+
71
+    ```bash
72
+    $ browserify app.js > bundle.js
73
+    ```
74
+
75
+1. include on your page
76
+
77
+    ```html
78
+    <script src="/path/to/bundle.js"></script>
79
+    ```
80
+
81
+## Features
82
+
83
+- Runs on browser and node.js seamlessly
84
+- Runs inside HTML5 WebWorker
85
+- Can encode and decode packets
86
+  - Encodes from/to ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer in Node
87
+
88
+## API
89
+
90
+Note: `cb(type)` means the type is a callback function that contains a parameter of type `type` when called.
91
+
92
+### Node
93
+
94
+- `encodePacket`
95
+    - Encodes a packet.
96
+    - **Parameters**
97
+      - `Object`: the packet to encode, has `type` and `data`.
98
+        - `data`: can be a `String`, `Number`, `Buffer`, `ArrayBuffer`
99
+      - `Boolean`: optional, binary support
100
+      - `Function`: callback, returns the encoded packet (`cb(String)`)
101
+- `decodePacket`
102
+    - Decodes a packet. Data also available as an ArrayBuffer if requested.
103
+    - Returns data as `String` or (`Blob` on browser, `ArrayBuffer` on Node)
104
+    - **Parameters**
105
+      - `String` | `ArrayBuffer`: the packet to decode, has `type` and `data`
106
+      - `String`: optional, the binary type
107
+
108
+- `encodeBase64Packet`
109
+    - Encodes a packet with binary data in a base64 string (`String`)
110
+    - **Parameters**
111
+      - `Object`: the packet to encode, has `type` and `data`
112
+      - `Function`: callback, returns the base64 encoded message (`cb(String)`)
113
+- `decodeBase64Packet`
114
+    - Decodes a packet encoded in a base64 string.
115
+    - **Parameters**
116
+      - `String`: the base64 encoded message
117
+      - `String`: optional, the binary type
118
+
119
+- `encodePayload`
120
+    - Encodes multiple messages (payload).
121
+    - If any contents are binary, they will be encoded as base64 strings. Base64
122
+      encoded strings are marked with a b before the length specifier
123
+    - **Parameters**
124
+      - `Array`: an array of packets
125
+      - `Boolean`: optional, binary support
126
+      - `Function`: callback, returns the encoded payload (`cb(String)`)
127
+- `decodePayload`
128
+    - Decodes data when a payload is maybe expected. Possible binary contents are
129
+      decoded from their base64 representation.
130
+    - **Parameters**
131
+      - `String`: the payload
132
+      - `String`: optional, the binary type
133
+      - `Function`: callback, returns (cb(`Object`: packet, `Number`:packet index, `Number`:packet total))
134
+
135
+- `encodePayloadAsBinary`
136
+    - Encodes multiple messages (payload) as binary.
137
+    - **Parameters**
138
+      - `Array`: an array of packets
139
+      - `Function`: callback, returns the encoded payload (`cb(Buffer)`)
140
+- `decodePayloadAsBinary`
141
+    - Decodes data when a payload is maybe expected. Strings are decoded by
142
+      interpreting each byte as a key code for entries marked to start with 0. See
143
+      description of encodePayloadAsBinary.
144
+    - **Parameters**
145
+      - `Buffer`: the buffer
146
+      - `String`: optional, the binary type
147
+      - `Function`: callback, returns the decoded packet (`cb(Object)`)
148
+
149
+### Browser
150
+
151
+- `encodePayloadAsArrayBuffer`
152
+    - Encodes multiple messages (payload) as binary.
153
+    - **Parameters**
154
+      - `Array`: an array of packets
155
+      - `Function`: callback, returns the encoded payload (`cb(ArrayBuffer)`)
156
+- `encodePayloadAsBlob`
157
+    - Encodes multiple messages (payload) as blob.
158
+    - **Parameters**
159
+      - `Array`: an array of packets
160
+      - `Function`: callback, returns the encoded payload (`cb(Blob)`)
161
+
162
+## Tests
163
+
164
+Standalone tests can be run with `make test` which will run both node.js and browser tests.
165
+
166
+Browser tests are run using [zuul](https://github.com/defunctzombie/zuul).
167
+(You must have zuul setup with a saucelabs account.)
168
+
169
+You can run the tests locally using the following command:
170
+
171
+```
172
+./node_modules/.bin/zuul --local 8080 -- test/index.js
173
+```
174
+
175
+## Support
176
+
177
+The support channels for `engine.io-parser` are the same as `socket.io`:
178
+  - irc.freenode.net **#socket.io**
179
+  - [Google Groups](http://groups.google.com/group/socket_io)
180
+  - [Website](http://socket.io)
181
+
182
+## Development
183
+
184
+To contribute patches, run tests or benchmarks, make sure to clone the
185
+repository:
186
+
187
+```bash
188
+git clone git://github.com/LearnBoost/engine.io-parser.git
189
+```
190
+
191
+Then:
192
+
193
+```bash
194
+cd engine.io-parser
195
+npm install
196
+```
197
+
198
+See the `Tests` section above for how to run tests before submitting any patches.
199
+
200
+## License
201
+
202
+MIT

+ 2
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/index.js Прегледај датотеку

@@ -0,0 +1,2 @@
1
+
2
+module.exports = require('./lib/');

+ 594
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/browser.js Прегледај датотеку

@@ -0,0 +1,594 @@
1
+/**
2
+ * Module dependencies.
3
+ */
4
+
5
+var keys = require('./keys');
6
+var hasBinary = require('has-binary');
7
+var sliceBuffer = require('arraybuffer.slice');
8
+var base64encoder = require('base64-arraybuffer');
9
+var after = require('after');
10
+var utf8 = require('utf8');
11
+
12
+/**
13
+ * Check if we are running an android browser. That requires us to use
14
+ * ArrayBuffer with polling transports...
15
+ *
16
+ * http://ghinda.net/jpeg-blob-ajax-android/
17
+ */
18
+
19
+var isAndroid = navigator.userAgent.match(/Android/i);
20
+
21
+/**
22
+ * Check if we are running in PhantomJS.
23
+ * Uploading a Blob with PhantomJS does not work correctly, as reported here:
24
+ * https://github.com/ariya/phantomjs/issues/11395
25
+ * @type boolean
26
+ */
27
+var isPhantomJS = /PhantomJS/i.test(navigator.userAgent);
28
+
29
+/**
30
+ * When true, avoids using Blobs to encode payloads.
31
+ * @type boolean
32
+ */
33
+var dontSendBlobs = isAndroid || isPhantomJS;
34
+
35
+/**
36
+ * Current protocol version.
37
+ */
38
+
39
+exports.protocol = 3;
40
+
41
+/**
42
+ * Packet types.
43
+ */
44
+
45
+var packets = exports.packets = {
46
+    open:     0    // non-ws
47
+  , close:    1    // non-ws
48
+  , ping:     2
49
+  , pong:     3
50
+  , message:  4
51
+  , upgrade:  5
52
+  , noop:     6
53
+};
54
+
55
+var packetslist = keys(packets);
56
+
57
+/**
58
+ * Premade error packet.
59
+ */
60
+
61
+var err = { type: 'error', data: 'parser error' };
62
+
63
+/**
64
+ * Create a blob api even for blob builder when vendor prefixes exist
65
+ */
66
+
67
+var Blob = require('blob');
68
+
69
+/**
70
+ * Encodes a packet.
71
+ *
72
+ *     <packet type id> [ <data> ]
73
+ *
74
+ * Example:
75
+ *
76
+ *     5hello world
77
+ *     3
78
+ *     4
79
+ *
80
+ * Binary is encoded in an identical principle
81
+ *
82
+ * @api private
83
+ */
84
+
85
+exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
86
+  if ('function' == typeof supportsBinary) {
87
+    callback = supportsBinary;
88
+    supportsBinary = false;
89
+  }
90
+
91
+  if ('function' == typeof utf8encode) {
92
+    callback = utf8encode;
93
+    utf8encode = null;
94
+  }
95
+
96
+  var data = (packet.data === undefined)
97
+    ? undefined
98
+    : packet.data.buffer || packet.data;
99
+
100
+  if (global.ArrayBuffer && data instanceof ArrayBuffer) {
101
+    return encodeArrayBuffer(packet, supportsBinary, callback);
102
+  } else if (Blob && data instanceof global.Blob) {
103
+    return encodeBlob(packet, supportsBinary, callback);
104
+  }
105
+
106
+  // might be an object with { base64: true, data: dataAsBase64String }
107
+  if (data && data.base64) {
108
+    return encodeBase64Object(packet, callback);
109
+  }
110
+
111
+  // Sending data as a utf-8 string
112
+  var encoded = packets[packet.type];
113
+
114
+  // data fragment is optional
115
+  if (undefined !== packet.data) {
116
+    encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
117
+  }
118
+
119
+  return callback('' + encoded);
120
+
121
+};
122
+
123
+function encodeBase64Object(packet, callback) {
124
+  // packet data is an object { base64: true, data: dataAsBase64String }
125
+  var message = 'b' + exports.packets[packet.type] + packet.data.data;
126
+  return callback(message);
127
+}
128
+
129
+/**
130
+ * Encode packet helpers for binary types
131
+ */
132
+
133
+function encodeArrayBuffer(packet, supportsBinary, callback) {
134
+  if (!supportsBinary) {
135
+    return exports.encodeBase64Packet(packet, callback);
136
+  }
137
+
138
+  var data = packet.data;
139
+  var contentArray = new Uint8Array(data);
140
+  var resultBuffer = new Uint8Array(1 + data.byteLength);
141
+
142
+  resultBuffer[0] = packets[packet.type];
143
+  for (var i = 0; i < contentArray.length; i++) {
144
+    resultBuffer[i+1] = contentArray[i];
145
+  }
146
+
147
+  return callback(resultBuffer.buffer);
148
+}
149
+
150
+function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
151
+  if (!supportsBinary) {
152
+    return exports.encodeBase64Packet(packet, callback);
153
+  }
154
+
155
+  var fr = new FileReader();
156
+  fr.onload = function() {
157
+    packet.data = fr.result;
158
+    exports.encodePacket(packet, supportsBinary, true, callback);
159
+  };
160
+  return fr.readAsArrayBuffer(packet.data);
161
+}
162
+
163
+function encodeBlob(packet, supportsBinary, callback) {
164
+  if (!supportsBinary) {
165
+    return exports.encodeBase64Packet(packet, callback);
166
+  }
167
+
168
+  if (dontSendBlobs) {
169
+    return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
170
+  }
171
+
172
+  var length = new Uint8Array(1);
173
+  length[0] = packets[packet.type];
174
+  var blob = new Blob([length.buffer, packet.data]);
175
+
176
+  return callback(blob);
177
+}
178
+
179
+/**
180
+ * Encodes a packet with binary data in a base64 string
181
+ *
182
+ * @param {Object} packet, has `type` and `data`
183
+ * @return {String} base64 encoded message
184
+ */
185
+
186
+exports.encodeBase64Packet = function(packet, callback) {
187
+  var message = 'b' + exports.packets[packet.type];
188
+  if (Blob && packet.data instanceof Blob) {
189
+    var fr = new FileReader();
190
+    fr.onload = function() {
191
+      var b64 = fr.result.split(',')[1];
192
+      callback(message + b64);
193
+    };
194
+    return fr.readAsDataURL(packet.data);
195
+  }
196
+
197
+  var b64data;
198
+  try {
199
+    b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
200
+  } catch (e) {
201
+    // iPhone Safari doesn't let you apply with typed arrays
202
+    var typed = new Uint8Array(packet.data);
203
+    var basic = new Array(typed.length);
204
+    for (var i = 0; i < typed.length; i++) {
205
+      basic[i] = typed[i];
206
+    }
207
+    b64data = String.fromCharCode.apply(null, basic);
208
+  }
209
+  message += global.btoa(b64data);
210
+  return callback(message);
211
+};
212
+
213
+/**
214
+ * Decodes a packet. Changes format to Blob if requested.
215
+ *
216
+ * @return {Object} with `type` and `data` (if any)
217
+ * @api private
218
+ */
219
+
220
+exports.decodePacket = function (data, binaryType, utf8decode) {
221
+  // String data
222
+  if (typeof data == 'string' || data === undefined) {
223
+    if (data.charAt(0) == 'b') {
224
+      return exports.decodeBase64Packet(data.substr(1), binaryType);
225
+    }
226
+
227
+    if (utf8decode) {
228
+      try {
229
+        data = utf8.decode(data);
230
+      } catch (e) {
231
+        return err;
232
+      }
233
+    }
234
+    var type = data.charAt(0);
235
+
236
+    if (Number(type) != type || !packetslist[type]) {
237
+      return err;
238
+    }
239
+
240
+    if (data.length > 1) {
241
+      return { type: packetslist[type], data: data.substring(1) };
242
+    } else {
243
+      return { type: packetslist[type] };
244
+    }
245
+  }
246
+
247
+  var asArray = new Uint8Array(data);
248
+  var type = asArray[0];
249
+  var rest = sliceBuffer(data, 1);
250
+  if (Blob && binaryType === 'blob') {
251
+    rest = new Blob([rest]);
252
+  }
253
+  return { type: packetslist[type], data: rest };
254
+};
255
+
256
+/**
257
+ * Decodes a packet encoded in a base64 string
258
+ *
259
+ * @param {String} base64 encoded message
260
+ * @return {Object} with `type` and `data` (if any)
261
+ */
262
+
263
+exports.decodeBase64Packet = function(msg, binaryType) {
264
+  var type = packetslist[msg.charAt(0)];
265
+  if (!global.ArrayBuffer) {
266
+    return { type: type, data: { base64: true, data: msg.substr(1) } };
267
+  }
268
+
269
+  var data = base64encoder.decode(msg.substr(1));
270
+
271
+  if (binaryType === 'blob' && Blob) {
272
+    data = new Blob([data]);
273
+  }
274
+
275
+  return { type: type, data: data };
276
+};
277
+
278
+/**
279
+ * Encodes multiple messages (payload).
280
+ *
281
+ *     <length>:data
282
+ *
283
+ * Example:
284
+ *
285
+ *     11:hello world2:hi
286
+ *
287
+ * If any contents are binary, they will be encoded as base64 strings. Base64
288
+ * encoded strings are marked with a b before the length specifier
289
+ *
290
+ * @param {Array} packets
291
+ * @api private
292
+ */
293
+
294
+exports.encodePayload = function (packets, supportsBinary, callback) {
295
+  if (typeof supportsBinary == 'function') {
296
+    callback = supportsBinary;
297
+    supportsBinary = null;
298
+  }
299
+
300
+  var isBinary = hasBinary(packets);
301
+
302
+  if (supportsBinary && isBinary) {
303
+    if (Blob && !dontSendBlobs) {
304
+      return exports.encodePayloadAsBlob(packets, callback);
305
+    }
306
+
307
+    return exports.encodePayloadAsArrayBuffer(packets, callback);
308
+  }
309
+
310
+  if (!packets.length) {
311
+    return callback('0:');
312
+  }
313
+
314
+  function setLengthHeader(message) {
315
+    return message.length + ':' + message;
316
+  }
317
+
318
+  function encodeOne(packet, doneCallback) {
319
+    exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) {
320
+      doneCallback(null, setLengthHeader(message));
321
+    });
322
+  }
323
+
324
+  map(packets, encodeOne, function(err, results) {
325
+    return callback(results.join(''));
326
+  });
327
+};
328
+
329
+/**
330
+ * Async array map using after
331
+ */
332
+
333
+function map(ary, each, done) {
334
+  var result = new Array(ary.length);
335
+  var next = after(ary.length, done);
336
+
337
+  var eachWithIndex = function(i, el, cb) {
338
+    each(el, function(error, msg) {
339
+      result[i] = msg;
340
+      cb(error, result);
341
+    });
342
+  };
343
+
344
+  for (var i = 0; i < ary.length; i++) {
345
+    eachWithIndex(i, ary[i], next);
346
+  }
347
+}
348
+
349
+/*
350
+ * Decodes data when a payload is maybe expected. Possible binary contents are
351
+ * decoded from their base64 representation
352
+ *
353
+ * @param {String} data, callback method
354
+ * @api public
355
+ */
356
+
357
+exports.decodePayload = function (data, binaryType, callback) {
358
+  if (typeof data != 'string') {
359
+    return exports.decodePayloadAsBinary(data, binaryType, callback);
360
+  }
361
+
362
+  if (typeof binaryType === 'function') {
363
+    callback = binaryType;
364
+    binaryType = null;
365
+  }
366
+
367
+  var packet;
368
+  if (data == '') {
369
+    // parser error - ignoring payload
370
+    return callback(err, 0, 1);
371
+  }
372
+
373
+  var length = ''
374
+    , n, msg;
375
+
376
+  for (var i = 0, l = data.length; i < l; i++) {
377
+    var chr = data.charAt(i);
378
+
379
+    if (':' != chr) {
380
+      length += chr;
381
+    } else {
382
+      if ('' == length || (length != (n = Number(length)))) {
383
+        // parser error - ignoring payload
384
+        return callback(err, 0, 1);
385
+      }
386
+
387
+      msg = data.substr(i + 1, n);
388
+
389
+      if (length != msg.length) {
390
+        // parser error - ignoring payload
391
+        return callback(err, 0, 1);
392
+      }
393
+
394
+      if (msg.length) {
395
+        packet = exports.decodePacket(msg, binaryType, true);
396
+
397
+        if (err.type == packet.type && err.data == packet.data) {
398
+          // parser error in individual packet - ignoring payload
399
+          return callback(err, 0, 1);
400
+        }
401
+
402
+        var ret = callback(packet, i + n, l);
403
+        if (false === ret) return;
404
+      }
405
+
406
+      // advance cursor
407
+      i += n;
408
+      length = '';
409
+    }
410
+  }
411
+
412
+  if (length != '') {
413
+    // parser error - ignoring payload
414
+    return callback(err, 0, 1);
415
+  }
416
+
417
+};
418
+
419
+/**
420
+ * Encodes multiple messages (payload) as binary.
421
+ *
422
+ * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
423
+ * 255><data>
424
+ *
425
+ * Example:
426
+ * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
427
+ *
428
+ * @param {Array} packets
429
+ * @return {ArrayBuffer} encoded payload
430
+ * @api private
431
+ */
432
+
433
+exports.encodePayloadAsArrayBuffer = function(packets, callback) {
434
+  if (!packets.length) {
435
+    return callback(new ArrayBuffer(0));
436
+  }
437
+
438
+  function encodeOne(packet, doneCallback) {
439
+    exports.encodePacket(packet, true, true, function(data) {
440
+      return doneCallback(null, data);
441
+    });
442
+  }
443
+
444
+  map(packets, encodeOne, function(err, encodedPackets) {
445
+    var totalLength = encodedPackets.reduce(function(acc, p) {
446
+      var len;
447
+      if (typeof p === 'string'){
448
+        len = p.length;
449
+      } else {
450
+        len = p.byteLength;
451
+      }
452
+      return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
453
+    }, 0);
454
+
455
+    var resultArray = new Uint8Array(totalLength);
456
+
457
+    var bufferIndex = 0;
458
+    encodedPackets.forEach(function(p) {
459
+      var isString = typeof p === 'string';
460
+      var ab = p;
461
+      if (isString) {
462
+        var view = new Uint8Array(p.length);
463
+        for (var i = 0; i < p.length; i++) {
464
+          view[i] = p.charCodeAt(i);
465
+        }
466
+        ab = view.buffer;
467
+      }
468
+
469
+      if (isString) { // not true binary
470
+        resultArray[bufferIndex++] = 0;
471
+      } else { // true binary
472
+        resultArray[bufferIndex++] = 1;
473
+      }
474
+
475
+      var lenStr = ab.byteLength.toString();
476
+      for (var i = 0; i < lenStr.length; i++) {
477
+        resultArray[bufferIndex++] = parseInt(lenStr[i]);
478
+      }
479
+      resultArray[bufferIndex++] = 255;
480
+
481
+      var view = new Uint8Array(ab);
482
+      for (var i = 0; i < view.length; i++) {
483
+        resultArray[bufferIndex++] = view[i];
484
+      }
485
+    });
486
+
487
+    return callback(resultArray.buffer);
488
+  });
489
+};
490
+
491
+/**
492
+ * Encode as Blob
493
+ */
494
+
495
+exports.encodePayloadAsBlob = function(packets, callback) {
496
+  function encodeOne(packet, doneCallback) {
497
+    exports.encodePacket(packet, true, true, function(encoded) {
498
+      var binaryIdentifier = new Uint8Array(1);
499
+      binaryIdentifier[0] = 1;
500
+      if (typeof encoded === 'string') {
501
+        var view = new Uint8Array(encoded.length);
502
+        for (var i = 0; i < encoded.length; i++) {
503
+          view[i] = encoded.charCodeAt(i);
504
+        }
505
+        encoded = view.buffer;
506
+        binaryIdentifier[0] = 0;
507
+      }
508
+
509
+      var len = (encoded instanceof ArrayBuffer)
510
+        ? encoded.byteLength
511
+        : encoded.size;
512
+
513
+      var lenStr = len.toString();
514
+      var lengthAry = new Uint8Array(lenStr.length + 1);
515
+      for (var i = 0; i < lenStr.length; i++) {
516
+        lengthAry[i] = parseInt(lenStr[i]);
517
+      }
518
+      lengthAry[lenStr.length] = 255;
519
+
520
+      if (Blob) {
521
+        var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
522
+        doneCallback(null, blob);
523
+      }
524
+    });
525
+  }
526
+
527
+  map(packets, encodeOne, function(err, results) {
528
+    return callback(new Blob(results));
529
+  });
530
+};
531
+
532
+/*
533
+ * Decodes data when a payload is maybe expected. Strings are decoded by
534
+ * interpreting each byte as a key code for entries marked to start with 0. See
535
+ * description of encodePayloadAsBinary
536
+ *
537
+ * @param {ArrayBuffer} data, callback method
538
+ * @api public
539
+ */
540
+
541
+exports.decodePayloadAsBinary = function (data, binaryType, callback) {
542
+  if (typeof binaryType === 'function') {
543
+    callback = binaryType;
544
+    binaryType = null;
545
+  }
546
+
547
+  var bufferTail = data;
548
+  var buffers = [];
549
+
550
+  var numberTooLong = false;
551
+  while (bufferTail.byteLength > 0) {
552
+    var tailArray = new Uint8Array(bufferTail);
553
+    var isString = tailArray[0] === 0;
554
+    var msgLength = '';
555
+
556
+    for (var i = 1; ; i++) {
557
+      if (tailArray[i] == 255) break;
558
+
559
+      if (msgLength.length > 310) {
560
+        numberTooLong = true;
561
+        break;
562
+      }
563
+
564
+      msgLength += tailArray[i];
565
+    }
566
+
567
+    if(numberTooLong) return callback(err, 0, 1);
568
+
569
+    bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
570
+    msgLength = parseInt(msgLength);
571
+
572
+    var msg = sliceBuffer(bufferTail, 0, msgLength);
573
+    if (isString) {
574
+      try {
575
+        msg = String.fromCharCode.apply(null, new Uint8Array(msg));
576
+      } catch (e) {
577
+        // iPhone Safari doesn't let you apply to typed arrays
578
+        var typed = new Uint8Array(msg);
579
+        msg = '';
580
+        for (var i = 0; i < typed.length; i++) {
581
+          msg += String.fromCharCode(typed[i]);
582
+        }
583
+      }
584
+    }
585
+
586
+    buffers.push(msg);
587
+    bufferTail = sliceBuffer(bufferTail, msgLength);
588
+  }
589
+
590
+  var total = buffers.length;
591
+  buffers.forEach(function(buffer, i) {
592
+    callback(exports.decodePacket(buffer, binaryType, true), i, total);
593
+  });
594
+};

+ 467
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/index.js Прегледај датотеку

@@ -0,0 +1,467 @@
1
+/**
2
+ * Module dependencies.
3
+ */
4
+
5
+var utf8 = require('utf8');
6
+var after = require('after');
7
+var keys = require('./keys');
8
+
9
+/**
10
+ * Current protocol version.
11
+ */
12
+exports.protocol = 3;
13
+
14
+/**
15
+ * Packet types.
16
+ */
17
+
18
+var packets = exports.packets = {
19
+    open:     0    // non-ws
20
+  , close:    1    // non-ws
21
+  , ping:     2
22
+  , pong:     3
23
+  , message:  4
24
+  , upgrade:  5
25
+  , noop:     6
26
+};
27
+
28
+var packetslist = keys(packets);
29
+
30
+/**
31
+ * Premade error packet.
32
+ */
33
+
34
+var err = { type: 'error', data: 'parser error' };
35
+
36
+/**
37
+ * Encodes a packet.
38
+ *
39
+ *     <packet type id> [ <data> ]
40
+ *
41
+ * Example:
42
+ *
43
+ *     5hello world
44
+ *     3
45
+ *     4
46
+ *
47
+ * Binary is encoded in an identical principle
48
+ *
49
+ * @api private
50
+ */
51
+
52
+exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
53
+  if ('function' == typeof supportsBinary) {
54
+    callback = supportsBinary;
55
+    supportsBinary = null;
56
+  }
57
+
58
+  if ('function' == typeof utf8encode ) {
59
+    callback = utf8encode;
60
+    utf8encode = null;
61
+  }
62
+
63
+  var data = (packet.data === undefined)
64
+    ? undefined
65
+    : packet.data.buffer || packet.data;
66
+
67
+  if (Buffer.isBuffer(data)) {
68
+    return encodeBuffer(packet, supportsBinary, callback);
69
+  } else if (data instanceof ArrayBuffer) {
70
+    return encodeArrayBuffer(packet, supportsBinary, callback);
71
+  }
72
+
73
+  // Sending data as a utf-8 string
74
+  var encoded = packets[packet.type];
75
+
76
+  // data fragment is optional
77
+  if (undefined !== packet.data) {
78
+    encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data);
79
+  }
80
+
81
+  return callback('' + encoded);
82
+};
83
+
84
+/**
85
+ * Encode Buffer data
86
+ */
87
+
88
+function encodeBuffer(packet, supportsBinary, callback) {
89
+  var data = packet.data;
90
+  if (!supportsBinary) {
91
+    return exports.encodeBase64Packet(packet, callback);
92
+  }
93
+
94
+  var typeBuffer = new Buffer(1);
95
+  typeBuffer[0] = packets[packet.type];
96
+  return callback(Buffer.concat([typeBuffer, data]));
97
+}
98
+
99
+function encodeArrayBuffer(packet, supportsBinary, callback) {
100
+  var data = (packet.data === undefined)
101
+    ? undefined
102
+    : packet.data.buffer || packet.data;
103
+
104
+  if (!supportsBinary) {
105
+    return exports.encodeBase64Packet(packet, callback);
106
+  }
107
+
108
+  var contentArray = new Uint8Array(data);
109
+  var resultBuffer = new Buffer(1 + data.byteLength);
110
+
111
+  resultBuffer[0] = packets[packet.type];
112
+  for (var i = 0; i < contentArray.length; i++){
113
+    resultBuffer[i+1] = contentArray[i];
114
+  }
115
+  return callback(resultBuffer);
116
+}
117
+
118
+/**
119
+ * Encodes a packet with binary data in a base64 string
120
+ *
121
+ * @param {Object} packet, has `type` and `data`
122
+ * @return {String} base64 encoded message
123
+ */
124
+
125
+exports.encodeBase64Packet = function(packet, callback){
126
+  var data = packet.data.buffer || packet.data;
127
+  if (data instanceof ArrayBuffer) {
128
+    var buf = new Buffer(data.byteLength);
129
+    for (var i = 0; i < buf.length; i++) {
130
+      buf[i] = data[i];
131
+    }
132
+    packet.data = buf;
133
+  }
134
+
135
+  var message = 'b' + packets[packet.type];
136
+  message += packet.data.toString('base64');
137
+  return callback(message);
138
+};
139
+
140
+/**
141
+ * Decodes a packet. Data also available as an ArrayBuffer if requested.
142
+ *
143
+ * @return {Object} with `type` and `data` (if any)
144
+ * @api private
145
+ */
146
+
147
+exports.decodePacket = function (data, binaryType, utf8decode) {
148
+  // String data
149
+  if (typeof data == 'string' || data === undefined) {
150
+    if (data.charAt(0) == 'b') {
151
+      return exports.decodeBase64Packet(data.substr(1), binaryType);
152
+    }
153
+
154
+    var type = data.charAt(0);
155
+    if (utf8decode) {
156
+      try {
157
+        data = utf8.decode(data);
158
+      } catch (e) {
159
+        return err;
160
+      }
161
+    }
162
+
163
+    if (Number(type) != type || !packetslist[type]) {
164
+      return err;
165
+    }
166
+
167
+    if (data.length > 1) {
168
+      return { type: packetslist[type], data: data.substring(1) };
169
+    } else {
170
+      return { type: packetslist[type] };
171
+    }
172
+  }
173
+
174
+  // Binary data
175
+  if (binaryType === 'arraybuffer') {
176
+    var type = data[0];
177
+    var intArray = new Uint8Array(data.length - 1);
178
+    for (var i = 1; i < data.length; i++) {
179
+      intArray[i - 1] = data[i];
180
+    }
181
+    return { type: packetslist[type], data: intArray.buffer };
182
+  }
183
+  var type = data[0];
184
+  return { type: packetslist[type], data: data.slice(1) };
185
+};
186
+
187
+/**
188
+ * Decodes a packet encoded in a base64 string.
189
+ *
190
+ * @param {String} base64 encoded message
191
+ * @return {Object} with `type` and `data` (if any)
192
+ */
193
+
194
+exports.decodeBase64Packet = function(msg, binaryType) {
195
+  var type = packetslist[msg.charAt(0)];
196
+  var data = new Buffer(msg.substr(1), 'base64');
197
+  if (binaryType === 'arraybuffer') {
198
+    var abv = new Uint8Array(data.length);
199
+    for (var i = 0; i < abv.length; i++){
200
+      abv[i] = data[i];
201
+    }
202
+    data = abv.buffer;
203
+  }
204
+  return { type: type, data: data };
205
+};
206
+
207
+/**
208
+ * Encodes multiple messages (payload).
209
+ *
210
+ *     <length>:data
211
+ *
212
+ * Example:
213
+ *
214
+ *     11:hello world2:hi
215
+ *
216
+ * If any contents are binary, they will be encoded as base64 strings. Base64
217
+ * encoded strings are marked with a b before the length specifier
218
+ *
219
+ * @param {Array} packets
220
+ * @api private
221
+ */
222
+
223
+exports.encodePayload = function (packets, supportsBinary, callback) {
224
+  if (typeof supportsBinary == 'function') {
225
+    callback = supportsBinary;
226
+    supportsBinary = null;
227
+  }
228
+
229
+  if (supportsBinary) {
230
+    return exports.encodePayloadAsBinary(packets, callback);
231
+  }
232
+
233
+  if (!packets.length) {
234
+    return callback('0:');
235
+  }
236
+
237
+  function setLengthHeader(message) {
238
+    return message.length + ':' + message;
239
+  }
240
+
241
+  function encodeOne(packet, doneCallback) {
242
+    exports.encodePacket(packet, supportsBinary, true, function(message) {
243
+      doneCallback(null, setLengthHeader(message));
244
+    });
245
+  }
246
+
247
+  map(packets, encodeOne, function(err, results) {
248
+    return callback(results.join(''));
249
+  });
250
+};
251
+
252
+/**
253
+ * Async array map using after
254
+ */
255
+
256
+function map(ary, each, done) {
257
+  var result = new Array(ary.length);
258
+  var next = after(ary.length, done);
259
+
260
+  var eachWithIndex = function(i, el, cb) {
261
+    each(el, function(error, msg) {
262
+      result[i] = msg;
263
+      cb(error, result);
264
+    });
265
+  };
266
+
267
+  for (var i = 0; i < ary.length; i++) {
268
+    eachWithIndex(i, ary[i], next);
269
+  }
270
+}
271
+
272
+/*
273
+ * Decodes data when a payload is maybe expected. Possible binary contents are
274
+ * decoded from their base64 representation
275
+ *
276
+ * @param {String} data, callback method
277
+ * @api public
278
+ */
279
+
280
+exports.decodePayload = function (data, binaryType, callback) {
281
+  if ('string' != typeof data) {
282
+    return exports.decodePayloadAsBinary(data, binaryType, callback);
283
+  }
284
+
285
+  if (typeof binaryType === 'function') {
286
+    callback = binaryType;
287
+    binaryType = null;
288
+  }
289
+
290
+  var packet;
291
+  if (data == '') {
292
+    // parser error - ignoring payload
293
+    return callback(err, 0, 1);
294
+  }
295
+
296
+  var length = ''
297
+    , n, msg;
298
+
299
+  for (var i = 0, l = data.length; i < l; i++) {
300
+    var chr = data.charAt(i);
301
+
302
+    if (':' != chr) {
303
+      length += chr;
304
+    } else {
305
+      if ('' == length || (length != (n = Number(length)))) {
306
+        // parser error - ignoring payload
307
+        return callback(err, 0, 1);
308
+      }
309
+
310
+      msg = data.substr(i + 1, n);
311
+
312
+      if (length != msg.length) {
313
+        // parser error - ignoring payload
314
+        return callback(err, 0, 1);
315
+      }
316
+
317
+      if (msg.length) {
318
+        packet = exports.decodePacket(msg, binaryType, true);
319
+
320
+        if (err.type == packet.type && err.data == packet.data) {
321
+          // parser error in individual packet - ignoring payload
322
+          return callback(err, 0, 1);
323
+        }
324
+
325
+        var ret = callback(packet, i + n, l);
326
+        if (false === ret) return;
327
+      }
328
+
329
+      // advance cursor
330
+      i += n;
331
+      length = '';
332
+    }
333
+  }
334
+
335
+  if (length != '') {
336
+    // parser error - ignoring payload
337
+    return callback(err, 0, 1);
338
+  }
339
+
340
+};
341
+
342
+/**
343
+ *
344
+ * Converts a buffer to a utf8.js encoded string
345
+ *
346
+ * @api private
347
+ */
348
+
349
+function bufferToString(buffer) {
350
+  var str = '';
351
+  for (var i = 0; i < buffer.length; i++) {
352
+    str += String.fromCharCode(buffer[i]);
353
+  }
354
+  return str;
355
+}
356
+
357
+/**
358
+ *
359
+ * Converts a utf8.js encoded string to a buffer
360
+ *
361
+ * @api private
362
+ */
363
+
364
+function stringToBuffer(string) {
365
+  var buf = new Buffer(string.length);
366
+  for (var i = 0; i < string.length; i++) {
367
+    buf.writeUInt8(string.charCodeAt(i), i);
368
+  }
369
+  return buf;
370
+}
371
+
372
+/**
373
+ * Encodes multiple messages (payload) as binary.
374
+ *
375
+ * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
376
+ * 255><data>
377
+ *
378
+ * Example:
379
+ * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
380
+ *
381
+ * @param {Array} packets
382
+ * @return {Buffer} encoded payload
383
+ * @api private
384
+ */
385
+
386
+exports.encodePayloadAsBinary = function (packets, callback) {
387
+  if (!packets.length) {
388
+    return callback(new Buffer(0));
389
+  }
390
+
391
+  function encodeOne(p, doneCallback) {
392
+    exports.encodePacket(p, true, true, function(packet) {
393
+
394
+      if (typeof packet === 'string') {
395
+        var encodingLength = '' + packet.length;
396
+        var sizeBuffer = new Buffer(encodingLength.length + 2);
397
+        sizeBuffer[0] = 0; // is a string (not true binary = 0)
398
+        for (var i = 0; i < encodingLength.length; i++) {
399
+          sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
400
+        }
401
+        sizeBuffer[sizeBuffer.length - 1] = 255;
402
+        return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)]));
403
+      }
404
+
405
+      var encodingLength = '' + packet.length;
406
+      var sizeBuffer = new Buffer(encodingLength.length + 2);
407
+      sizeBuffer[0] = 1; // is binary (true binary = 1)
408
+      for (var i = 0; i < encodingLength.length; i++) {
409
+        sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
410
+      }
411
+      sizeBuffer[sizeBuffer.length - 1] = 255;
412
+      doneCallback(null, Buffer.concat([sizeBuffer, packet]));
413
+    });
414
+  }
415
+
416
+  map(packets, encodeOne, function(err, results) {
417
+    return callback(Buffer.concat(results));
418
+  });
419
+};
420
+
421
+/*
422
+ * Decodes data when a payload is maybe expected. Strings are decoded by
423
+ * interpreting each byte as a key code for entries marked to start with 0. See
424
+ * description of encodePayloadAsBinary
425
+
426
+ * @param {Buffer} data, callback method
427
+ * @api public
428
+ */
429
+
430
+exports.decodePayloadAsBinary = function (data, binaryType, callback) {
431
+  if (typeof binaryType === 'function') {
432
+    callback = binaryType;
433
+    binaryType = null;
434
+  }
435
+
436
+  var bufferTail = data;
437
+  var buffers = [];
438
+
439
+  while (bufferTail.length > 0) {
440
+    var strLen = '';
441
+    var isString = bufferTail[0] === 0;
442
+    var numberTooLong = false;
443
+    for (var i = 1; ; i++) {
444
+      if (bufferTail[i] == 255)  break;
445
+      // 310 = char length of Number.MAX_VALUE
446
+      if (strLen.length > 310) {
447
+        numberTooLong = true;
448
+        break;
449
+      }
450
+      strLen += '' + bufferTail[i];
451
+    }
452
+    if(numberTooLong) return callback(err, 0, 1);
453
+    bufferTail = bufferTail.slice(strLen.length + 1);
454
+
455
+    var msgLength = parseInt(strLen, 10);
456
+
457
+    var msg = bufferTail.slice(1, msgLength + 1);
458
+    if (isString) msg = bufferToString(msg);
459
+    buffers.push(msg);
460
+    bufferTail = bufferTail.slice(msgLength + 1);
461
+  }
462
+
463
+  var total = buffers.length;
464
+  buffers.forEach(function(buffer, i) {
465
+    callback(exports.decodePacket(buffer, binaryType, true), i, total);
466
+  });
467
+};

+ 19
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/lib/keys.js Прегледај датотеку

@@ -0,0 +1,19 @@
1
+
2
+/**
3
+ * Gets the keys for an object.
4
+ *
5
+ * @return {Array} keys
6
+ * @api private
7
+ */
8
+
9
+module.exports = Object.keys || function keys (obj){
10
+  var arr = [];
11
+  var has = Object.prototype.hasOwnProperty;
12
+
13
+  for (var i in obj) {
14
+    if (has.call(obj, i)) {
15
+      arr.push(i);
16
+    }
17
+  }
18
+  return arr;
19
+};

+ 2
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.npmignore Прегледај датотеку

@@ -0,0 +1,2 @@
1
+node_modules
2
+.monitor

+ 5
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/.travis.yml Прегледај датотеку

@@ -0,0 +1,5 @@
1
+language: node_js
2
+node_js:
3
+  - 0.6
4
+  - 0.8
5
+  - 0.9

+ 19
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/LICENCE Прегледај датотеку

@@ -0,0 +1,19 @@
1
+Copyright (c) 2011 Raynos.
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.

+ 75
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/README.md Прегледај датотеку

@@ -0,0 +1,75 @@
1
+# After [![Build Status][1]][2]
2
+
3
+Invoke callback after n calls
4
+
5
+## Status: production ready
6
+
7
+## Example
8
+
9
+    var after = require("after")
10
+        , next = after(3, logItWorks)
11
+
12
+    next()
13
+    next()
14
+    next() // it works
15
+
16
+    function logItWorks() {
17
+        console.log("it works!")
18
+    }
19
+
20
+## Example with error handling
21
+
22
+    var after = require("after")
23
+        , next = after(3, logError)
24
+
25
+    next()
26
+    next(new Error("oops")) // logs oops
27
+    next() // does nothing
28
+
29
+    function logError(err) {
30
+        console.log(err)
31
+    }
32
+
33
+## After < 0.6.0
34
+
35
+Older versions of after had iterators and flows in them.
36
+
37
+These have been replaced with seperate modules
38
+
39
+ - [iterators][8]
40
+ - [composite][9]
41
+
42
+## Installation
43
+
44
+`npm install after`
45
+
46
+## Tests
47
+
48
+`npm test`
49
+
50
+## Blog post
51
+
52
+ - [Flow control in node.js][3]
53
+
54
+## Examples :
55
+
56
+ - [Determining the end of asynchronous operations][4]
57
+ - [In javascript what are best practices for executing multiple asynchronous functions][5]
58
+ - [JavaScript performance long running tasks][6]
59
+ - [Synchronous database queries with node.js][7]
60
+
61
+## Contributors
62
+
63
+ - Raynos
64
+
65
+## MIT Licenced
66
+
67
+  [1]: https://secure.travis-ci.org/Raynos/after.png
68
+  [2]: http://travis-ci.org/Raynos/after
69
+  [3]: http://raynos.org/blog/2/Flow-control-in-node.js
70
+  [4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307
71
+  [5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031
72
+  [6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419
73
+  [7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091
74
+  [8]: http://github.com/Raynos/iterators
75
+  [9]: http://github.com/Raynos/composite

+ 28
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/index.js Прегледај датотеку

@@ -0,0 +1,28 @@
1
+module.exports = after
2
+
3
+function after(count, callback, err_cb) {
4
+    var bail = false
5
+    err_cb = err_cb || noop
6
+    proxy.count = count
7
+
8
+    return (count === 0) ? callback() : proxy
9
+
10
+    function proxy(err, result) {
11
+        if (proxy.count <= 0) {
12
+            throw new Error('after called too many times')
13
+        }
14
+        --proxy.count
15
+
16
+        // after first error, rest are passed to err_cb
17
+        if (err) {
18
+            bail = true
19
+            callback(err)
20
+            // future error callbacks will go to error handler
21
+            callback = err_cb
22
+        } else if (proxy.count === 0 && !bail) {
23
+            callback(null, result)
24
+        }
25
+    }
26
+}
27
+
28
+function noop() {}

+ 61
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/after/package.json Прегледај датотеку

@@ -0,0 +1,61 @@
1
+{
2
+  "name": "after",
3
+  "description": "after - tiny flow control",
4
+  "version": "0.8.1",
5
+  "author": {
6
+    "name": "Raynos",
7
+    "email": "raynos2@gmail.com"
8
+  },
9
+  "contributors": [
10
+    {
11
+      "name": "Raynos",
12
+      "email": "raynos2@gmail.com",
13
+      "url": "http://raynos.org"
14
+    }
15
+  ],
16
+  "scripts": {
17
+    "test": "mocha --ui tdd --reporter spec test/*.js"
18
+  },
19
+  "devDependencies": {
20
+    "mocha": "~1.8.1"
21
+  },
22
+  "keywords": [
23
+    "flowcontrol",
24
+    "after",
25
+    "flow",
26
+    "control",
27
+    "arch"
28
+  ],
29
+  "repository": {
30
+    "type": "git",
31
+    "url": "git://github.com/Raynos/after.git"
32
+  },
33
+  "bugs": {
34
+    "url": "https://github.com/Raynos/after/issues"
35
+  },
36
+  "_id": "after@0.8.1",
37
+  "dist": {
38
+    "shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627",
39
+    "tarball": "http://registry.npmjs.org/after/-/after-0.8.1.tgz"
40
+  },
41
+  "_from": "after@0.8.1",
42
+  "_npmVersion": "1.2.25",
43
+  "_npmUser": {
44
+    "name": "raynos",
45
+    "email": "raynos2@gmail.com"
46
+  },
47
+  "maintainers": [
48
+    {
49
+      "name": "raynos",
50
+      "email": "raynos2@gmail.com"
51
+    },
52
+    {
53
+      "name": "shtylman",
54
+      "email": "shtylman@gmail.com"
55
+    }
56
+  ],
57
+  "directories": {},
58
+  "_shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627",
59
+  "_resolved": "https://registry.npmjs.org/after/-/after-0.8.1.tgz",
60
+  "readme": "ERROR: No README data found!"
61
+}

+ 17
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/.npmignore Прегледај датотеку

@@ -0,0 +1,17 @@
1
+lib-cov
2
+lcov.info
3
+*.seed
4
+*.log
5
+*.csv
6
+*.dat
7
+*.out
8
+*.pid
9
+*.gz
10
+
11
+pids
12
+logs
13
+results
14
+build
15
+.grunt
16
+
17
+node_modules

+ 8
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/Makefile Прегледај датотеку

@@ -0,0 +1,8 @@
1
+
2
+REPORTER = dot
3
+
4
+test:
5
+	@./node_modules/.bin/mocha \
6
+		--reporter $(REPORTER)
7
+
8
+.PHONY: test

+ 17
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/README.md Прегледај датотеку

@@ -0,0 +1,17 @@
1
+# How to
2
+```javascript
3
+var sliceBuffer = require('arraybuffer.slice');
4
+var ab = (new Int8Array(5)).buffer;
5
+var sliced = sliceBuffer(ab, 1, 3);
6
+sliced = sliceBuffer(ab, 1);
7
+```
8
+
9
+# Licence (MIT)
10
+Copyright (C) 2013 Rase-
11
+
12
+
13
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
14
+
15
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
16
+
17
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 29
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/index.js Прегледај датотеку

@@ -0,0 +1,29 @@
1
+/**
2
+ * An abstraction for slicing an arraybuffer even when
3
+ * ArrayBuffer.prototype.slice is not supported
4
+ *
5
+ * @api public
6
+ */
7
+
8
+module.exports = function(arraybuffer, start, end) {
9
+  var bytes = arraybuffer.byteLength;
10
+  start = start || 0;
11
+  end = end || bytes;
12
+
13
+  if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
14
+
15
+  if (start < 0) { start += bytes; }
16
+  if (end < 0) { end += bytes; }
17
+  if (end > bytes) { end = bytes; }
18
+
19
+  if (start >= bytes || start >= end || bytes === 0) {
20
+    return new ArrayBuffer(0);
21
+  }
22
+
23
+  var abv = new Uint8Array(arraybuffer);
24
+  var result = new Uint8Array(end - start);
25
+  for (var i = start, ii = 0; i < end; i++, ii++) {
26
+    result[ii] = abv[i];
27
+  }
28
+  return result.buffer;
29
+};

+ 39
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/arraybuffer.slice/package.json Прегледај датотеку

@@ -0,0 +1,39 @@
1
+{
2
+  "name": "arraybuffer.slice",
3
+  "description": "Exports a function for slicing ArrayBuffers (no polyfilling)",
4
+  "version": "0.0.6",
5
+  "homepage": "https://github.com/rase-/arraybuffer.slice",
6
+  "dependencies": {},
7
+  "devDependencies": {
8
+    "mocha": "1.17.1",
9
+    "expect.js": "0.2.0"
10
+  },
11
+  "repository": {
12
+    "type": "git",
13
+    "url": "git@github.com:rase-/arraybuffer.slice.git"
14
+  },
15
+  "bugs": {
16
+    "url": "https://github.com/rase-/arraybuffer.slice/issues"
17
+  },
18
+  "_id": "arraybuffer.slice@0.0.6",
19
+  "dist": {
20
+    "shasum": "f33b2159f0532a3f3107a272c0ccfbd1ad2979ca",
21
+    "tarball": "http://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz"
22
+  },
23
+  "_from": "arraybuffer.slice@0.0.6",
24
+  "_npmVersion": "1.3.5",
25
+  "_npmUser": {
26
+    "name": "rase-",
27
+    "email": "tonykovanen@hotmail.com"
28
+  },
29
+  "maintainers": [
30
+    {
31
+      "name": "rase-",
32
+      "email": "tonykovanen@hotmail.com"
33
+    }
34
+  ],
35
+  "directories": {},
36
+  "_shasum": "f33b2159f0532a3f3107a272c0ccfbd1ad2979ca",
37
+  "_resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz",
38
+  "readme": "ERROR: No README data found!"
39
+}

+ 1
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.npmignore Прегледај датотеку

@@ -0,0 +1 @@
1
+/node_modules/

+ 6
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/.travis.yml Прегледај датотеку

@@ -0,0 +1,6 @@
1
+---
2
+language: node_js
3
+node_js:
4
+- '0.10'
5
+before_script:
6
+- npm install

+ 22
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/LICENSE-MIT Прегледај датотеку

@@ -0,0 +1,22 @@
1
+Copyright (c) 2012 Niklas von Hertzen
2
+
3
+Permission is hereby granted, free of charge, to any person
4
+obtaining a copy of this software and associated documentation
5
+files (the "Software"), to deal in the Software without
6
+restriction, including without limitation the rights to use,
7
+copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+copies of the Software, and to permit persons to whom the
9
+Software is furnished to do so, subject to the following
10
+conditions:
11
+
12
+The above copyright notice and this permission notice shall be
13
+included in all copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+OTHER DEALINGS IN THE SOFTWARE.

+ 23
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/README.md Прегледај датотеку

@@ -0,0 +1,23 @@
1
+# base64-arraybuffer
2
+
3
+[![Build Status](https://travis-ci.org/niklasvh/base64-arraybuffer.png)](https://travis-ci.org/niklasvh/base64-arraybuffer)
4
+
5
+Encode/decode base64 data into ArrayBuffers
6
+
7
+## Getting Started
8
+Install the module with: `npm install base64-arraybuffer`
9
+
10
+## API
11
+The library encodes and decodes base64 to and from ArrayBuffers
12
+
13
+ - __encode(buffer)__ - Encodes `ArrayBuffer` into base64 string
14
+ - __decode(str)__ - Decodes base64 string to `ArrayBuffer`
15
+
16
+## Release History
17
+
18
+ - 0.1.2 - Fix old format of typed arrays
19
+ - 0.1.0 - Initial version, basic decode/encode base64 to and from ArrayBuffer
20
+
21
+## License
22
+Copyright (c) 2012 Niklas von Hertzen
23
+Licensed under the MIT license.

+ 39
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/grunt.js Прегледај датотеку

@@ -0,0 +1,39 @@
1
+module.exports = function(grunt) {
2
+  "use strict";
3
+  // Project configuration.
4
+  grunt.initConfig({
5
+    pkg: '<json:package.json>',
6
+    test: {
7
+      files: ['test/**/*.js']
8
+    },
9
+    lint: {
10
+      files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js']
11
+    },
12
+    watch: {
13
+      files: '<config:lint.files>',
14
+      tasks: 'default'
15
+    },
16
+    jshint: {
17
+      options: {
18
+        curly: true,
19
+        eqeqeq: true,
20
+        immed: true,
21
+        latedef: true,
22
+        newcap: true,
23
+        noarg: true,
24
+        sub: true,
25
+        undef: true,
26
+        boss: true,
27
+        eqnull: true,
28
+        node: true
29
+      },
30
+      globals: {
31
+        exports: true
32
+      }
33
+    }
34
+  });
35
+
36
+  // Default task.
37
+  grunt.registerTask('default', 'test');
38
+
39
+};

+ 59
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/lib/base64-arraybuffer.js Прегледај датотеку

@@ -0,0 +1,59 @@
1
+/*
2
+ * base64-arraybuffer
3
+ * https://github.com/niklasvh/base64-arraybuffer
4
+ *
5
+ * Copyright (c) 2012 Niklas von Hertzen
6
+ * Licensed under the MIT license.
7
+ */
8
+(function(chars){
9
+  "use strict";
10
+
11
+  exports.encode = function(arraybuffer) {
12
+    var bytes = new Uint8Array(arraybuffer),
13
+    i, len = bytes.length, base64 = "";
14
+
15
+    for (i = 0; i < len; i+=3) {
16
+      base64 += chars[bytes[i] >> 2];
17
+      base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
18
+      base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
19
+      base64 += chars[bytes[i + 2] & 63];
20
+    }
21
+
22
+    if ((len % 3) === 2) {
23
+      base64 = base64.substring(0, base64.length - 1) + "=";
24
+    } else if (len % 3 === 1) {
25
+      base64 = base64.substring(0, base64.length - 2) + "==";
26
+    }
27
+
28
+    return base64;
29
+  };
30
+
31
+  exports.decode =  function(base64) {
32
+    var bufferLength = base64.length * 0.75,
33
+    len = base64.length, i, p = 0,
34
+    encoded1, encoded2, encoded3, encoded4;
35
+
36
+    if (base64[base64.length - 1] === "=") {
37
+      bufferLength--;
38
+      if (base64[base64.length - 2] === "=") {
39
+        bufferLength--;
40
+      }
41
+    }
42
+
43
+    var arraybuffer = new ArrayBuffer(bufferLength),
44
+    bytes = new Uint8Array(arraybuffer);
45
+
46
+    for (i = 0; i < len; i+=4) {
47
+      encoded1 = chars.indexOf(base64[i]);
48
+      encoded2 = chars.indexOf(base64[i+1]);
49
+      encoded3 = chars.indexOf(base64[i+2]);
50
+      encoded4 = chars.indexOf(base64[i+3]);
51
+
52
+      bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
53
+      bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
54
+      bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
55
+    }
56
+
57
+    return arraybuffer;
58
+  };
59
+})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");

+ 56
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/base64-arraybuffer/package.json Прегледај датотеку

@@ -0,0 +1,56 @@
1
+{
2
+  "name": "base64-arraybuffer",
3
+  "description": "Encode/decode base64 data into ArrayBuffers",
4
+  "version": "0.1.2",
5
+  "homepage": "https://github.com/niklasvh/base64-arraybuffer",
6
+  "author": {
7
+    "name": "Niklas von Hertzen",
8
+    "email": "niklasvh@gmail.com",
9
+    "url": "http://hertzen.com"
10
+  },
11
+  "repository": {
12
+    "type": "git",
13
+    "url": "https://github.com/niklasvh/base64-arraybuffer"
14
+  },
15
+  "bugs": {
16
+    "url": "https://github.com/niklasvh/base64-arraybuffer/issues"
17
+  },
18
+  "licenses": [
19
+    {
20
+      "type": "MIT",
21
+      "url": "https://github.com/niklasvh/base64-arraybuffer/blob/master/LICENSE-MIT"
22
+    }
23
+  ],
24
+  "main": "lib/base64-arraybuffer",
25
+  "engines": {
26
+    "node": ">= 0.6.0"
27
+  },
28
+  "scripts": {
29
+    "test": "grunt test"
30
+  },
31
+  "devDependencies": {
32
+    "grunt": "~0.3.17"
33
+  },
34
+  "keywords": [],
35
+  "_id": "base64-arraybuffer@0.1.2",
36
+  "dist": {
37
+    "shasum": "474df4a9f2da24e05df3158c3b1db3c3cd46a154",
38
+    "tarball": "http://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz"
39
+  },
40
+  "_from": "base64-arraybuffer@0.1.2",
41
+  "_npmVersion": "1.3.21",
42
+  "_npmUser": {
43
+    "name": "niklasvh",
44
+    "email": "niklasvh@gmail.com"
45
+  },
46
+  "maintainers": [
47
+    {
48
+      "name": "niklasvh",
49
+      "email": "niklasvh@gmail.com"
50
+    }
51
+  ],
52
+  "directories": {},
53
+  "_shasum": "474df4a9f2da24e05df3158c3b1db3c3cd46a154",
54
+  "_resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz",
55
+  "readme": "ERROR: No README data found!"
56
+}

+ 2
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.npmignore Прегледај датотеку

@@ -0,0 +1,2 @@
1
+node_modules
2
+blob.js

+ 8
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/.zuul.yml Прегледај датотеку

@@ -0,0 +1,8 @@
1
+ui: mocha-bdd
2
+browsers:
3
+  - name: chrome
4
+    version: [8, latest]
5
+  - name: ie
6
+    version: 10
7
+  - name: android
8
+    version: latest

+ 14
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/Makefile Прегледај датотеку

@@ -0,0 +1,14 @@
1
+REPORTER = dot
2
+
3
+build: blob.js
4
+
5
+blob.js:
6
+	@./node_modules/.bin/browserify --standalone blob index.js > blob.js
7
+
8
+test:
9
+	@./node_modules/.bin/zuul -- test/index.js
10
+
11
+clean:
12
+	rm blob.js
13
+
14
+.PHONY: test blob.js

+ 11
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/README.md Прегледај датотеку

@@ -0,0 +1,11 @@
1
+Blob
2
+====
3
+
4
+A module that exports a constructor that uses window.Blob when available, and a BlobBuilder with any vendor prefix in other cases. If neither is available, it exports undefined.
5
+
6
+Usage:
7
+
8
+```javascript
9
+var Blob = require('blob');
10
+var b = new Blob(['hi', 'constructing', 'a', 'blob']);
11
+```

+ 49
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/index.js Прегледај датотеку

@@ -0,0 +1,49 @@
1
+/**
2
+ * Create a blob builder even when vendor prefixes exist
3
+ */
4
+
5
+var BlobBuilder = global.BlobBuilder
6
+  || global.WebKitBlobBuilder
7
+  || global.MSBlobBuilder
8
+  || global.MozBlobBuilder;
9
+
10
+/**
11
+ * Check if Blob constructor is supported
12
+ */
13
+
14
+var blobSupported = (function() {
15
+  try {
16
+    var b = new Blob(['hi']);
17
+    return b.size == 2;
18
+  } catch(e) {
19
+    return false;
20
+  }
21
+})();
22
+
23
+/**
24
+ * Check if BlobBuilder is supported
25
+ */
26
+
27
+var blobBuilderSupported = BlobBuilder
28
+  && BlobBuilder.prototype.append
29
+  && BlobBuilder.prototype.getBlob;
30
+
31
+function BlobBuilderConstructor(ary, options) {
32
+  options = options || {};
33
+
34
+  var bb = new BlobBuilder();
35
+  for (var i = 0; i < ary.length; i++) {
36
+    bb.append(ary[i]);
37
+  }
38
+  return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
39
+};
40
+
41
+module.exports = (function() {
42
+  if (blobSupported) {
43
+    return global.Blob;
44
+  } else if (blobBuilderSupported) {
45
+    return BlobBuilderConstructor;
46
+  } else {
47
+    return undefined;
48
+  }
49
+})();

+ 44
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/blob/package.json Прегледај датотеку

@@ -0,0 +1,44 @@
1
+{
2
+  "name": "blob",
3
+  "description": "Abstracts out Blob and uses BlobBulder in cases where it is supported with any vendor prefix.",
4
+  "version": "0.0.2",
5
+  "homepage": "https://github.com/rase-/blob",
6
+  "dependencies": {},
7
+  "devDependencies": {
8
+    "mocha": "1.17.1",
9
+    "expect.js": "0.2.0",
10
+    "zuul": "1.5.4",
11
+    "browserify": "3.30.1"
12
+  },
13
+  "repository": {
14
+    "type": "git",
15
+    "url": "git@github.com:rase-/blob.git"
16
+  },
17
+  "scripts": {
18
+    "test": "make test"
19
+  },
20
+  "bugs": {
21
+    "url": "https://github.com/rase-/blob/issues"
22
+  },
23
+  "_id": "blob@0.0.2",
24
+  "dist": {
25
+    "shasum": "b89562bd6994af95ba1e812155536333aa23cf24",
26
+    "tarball": "http://registry.npmjs.org/blob/-/blob-0.0.2.tgz"
27
+  },
28
+  "_from": "blob@0.0.2",
29
+  "_npmVersion": "1.3.5",
30
+  "_npmUser": {
31
+    "name": "rase-",
32
+    "email": "tonykovanen@hotmail.com"
33
+  },
34
+  "maintainers": [
35
+    {
36
+      "name": "rase-",
37
+      "email": "tonykovanen@hotmail.com"
38
+    }
39
+  ],
40
+  "directories": {},
41
+  "_shasum": "b89562bd6994af95ba1e812155536333aa23cf24",
42
+  "_resolved": "https://registry.npmjs.org/blob/-/blob-0.0.2.tgz",
43
+  "readme": "ERROR: No README data found!"
44
+}

+ 15
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/.npmignore Прегледај датотеку

@@ -0,0 +1,15 @@
1
+lib-cov
2
+*.seed
3
+*.log
4
+*.csv
5
+*.dat
6
+*.out
7
+*.pid
8
+*.gz
9
+
10
+pids
11
+logs
12
+results
13
+
14
+npm-debug.log
15
+node_modules

+ 5
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/History.md Прегледај датотеку

@@ -0,0 +1,5 @@
1
+
2
+0.1.5 / 2014-09-04
3
+==================
4
+
5
+ * prevent browserify from bundling `Buffer`

+ 20
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/LICENSE Прегледај датотеку

@@ -0,0 +1,20 @@
1
+The MIT License (MIT)
2
+
3
+Copyright (c) 2014 Kevin Roark
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+this software and associated documentation files (the "Software"), to deal in
7
+the Software without restriction, including without limitation the rights to
8
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+the Software, and to permit persons to whom the Software is furnished to do so,
10
+subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 3
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/Makefile Прегледај датотеку

@@ -0,0 +1,3 @@
1
+
2
+test:
3
+	@./node_modules/.bin/mocha test.js

+ 4
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/README.md Прегледај датотеку

@@ -0,0 +1,4 @@
1
+has-binarydata.js
2
+=================
3
+
4
+Simple module to test if an object contains binary data

+ 1
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/fixtures/big.json
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 0
- 0
web/multi/server/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/has-binary/index.js Прегледај датотеку


Неке датотеке нису приказане због велике количине промена