UNPKG

2.28 kBJavaScriptView Raw
1/*
2 * Copyright (c) 2012 Dmitri Melikyan
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to permit
9 * persons to whom the Software is furnished to do so, subject to the
10 * following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
18 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24
25var nt = require('../nodetime');
26var proxy = require('../proxy');
27var samples = require('../samples');
28
29module.exports = function(obj) {
30 return; // temporary disabled
31
32 proxy.after(obj, 'listen', function(obj, args, ret) {
33 if(!ret.sockets) return;
34
35 proxy.before(ret.sockets, ['on', 'addListener'], function(obj, args) {
36 if(args[0] !== 'connection') return;
37
38 proxy.callback(args, -1, function(obj, args) {
39 var socket = args[0];
40
41 /*proxy.before(socket, ['on', 'addListener'], function(obj, args) {
42 if(nt.paused) return;
43
44 var msg = args[0];
45 var time = undefined;
46
47 proxy.callback(args, -1, function(obj, args) {
48 time = samples.time("Socket.io", msg, true);
49 });
50
51 proxy.after(socket, ['emit', 'send'], function(obj, args) {
52 if(!time || !time.done()) return;
53
54 samples.add(time, {'Type': 'Socket.io',
55 'Message': msg,
56 'Namespace': socket.namespace ? socket.namespace.name : undefined},
57 'Socket.io: ' + msg);
58 });
59 });*/
60 });
61 });
62 });
63};
64