comparison node_modules/socket.io/lib/socket.io.js @ 69:333afcfd3f3a

added node_modules to project and fixed path to chronometer also added deps to installer script
author tzara <rc-web@kiben.net>
date Sat, 26 Oct 2013 14:12:50 +0100
parents
children
comparison
equal deleted inserted replaced
68:b076cd17638c 69:333afcfd3f3a
1
2 /*!
3 * socket.io-node
4 * Copyright(c) 2011 LearnBoost <dev@learnboost.com>
5 * MIT Licensed
6 */
7
8 /**
9 * Module dependencies.
10 */
11
12 var client = require('socket.io-client');
13
14 /**
15 * Version.
16 */
17
18 exports.version = '0.9.16';
19
20 /**
21 * Supported protocol version.
22 */
23
24 exports.protocol = 1;
25
26 /**
27 * Client that we serve.
28 */
29
30 exports.clientVersion = client.version;
31
32 /**
33 * Attaches a manager
34 *
35 * @param {HTTPServer/Number} a HTTP/S server or a port number to listen on.
36 * @param {Object} opts to be passed to Manager and/or http server
37 * @param {Function} callback if a port is supplied
38 * @api public
39 */
40
41 exports.listen = function (server, options, fn) {
42 if ('function' == typeof server) {
43 console.warn('Socket.IO\'s `listen()` method expects an `http.Server` instance\n'
44 + 'as its first parameter. Are you migrating from Express 2.x to 3.x?\n'
45 + 'If so, check out the "Socket.IO compatibility" section at:\n'
46 + 'https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x');
47 }
48
49 if ('function' == typeof options) {
50 fn = options;
51 options = {};
52 }
53
54 if ('undefined' == typeof server) {
55 // create a server that listens on port 80
56 server = 80;
57 }
58
59 if ('number' == typeof server) {
60 // if a port number is passed
61 var port = server;
62
63 if (options && options.key)
64 server = require('https').createServer(options);
65 else
66 server = require('http').createServer();
67
68 // default response
69 server.on('request', function (req, res) {
70 res.writeHead(200);
71 res.end('Welcome to socket.io.');
72 });
73
74 server.listen(port, fn);
75 }
76
77 // otherwise assume a http/s server
78 return new exports.Manager(server, options);
79 };
80
81 /**
82 * Manager constructor.
83 *
84 * @api public
85 */
86
87 exports.Manager = require('./manager');
88
89 /**
90 * Transport constructor.
91 *
92 * @api public
93 */
94
95 exports.Transport = require('./transport');
96
97 /**
98 * Socket constructor.
99 *
100 * @api public
101 */
102
103 exports.Socket = require('./socket');
104
105 /**
106 * Static constructor.
107 *
108 * @api public
109 */
110
111 exports.Static = require('./static');
112
113 /**
114 * Store constructor.
115 *
116 * @api public
117 */
118
119 exports.Store = require('./store');
120
121 /**
122 * Memory Store constructor.
123 *
124 * @api public
125 */
126
127 exports.MemoryStore = require('./stores/memory');
128
129 /**
130 * Redis Store constructor.
131 *
132 * @api public
133 */
134
135 exports.RedisStore = require('./stores/redis');
136
137 /**
138 * Parser.
139 *
140 * @api public
141 */
142
143 exports.parser = require('./parser');