diff --git a/AUTHORS.md b/AUTHORS.md index 842dc17a..9305d3ef 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -23,3 +23,4 @@ Authors ordered by first contribution: - Richard Waller (https://github.com/rwalle61) - Russell Howe (https://github.com/rhowe-gds) - Gaby Baghdadi (https://github.com/gabylb) + - Mark Frost (https://github.com/frostmar) diff --git a/probes/socketio-probe.js b/probes/socketio-probe.js index da27ada1..f135b22a 100644 --- a/probes/socketio-probe.js +++ b/probes/socketio-probe.js @@ -28,6 +28,16 @@ util.inherits(SocketioProbe, Probe); SocketioProbe.prototype.attach = function(name, target) { var that = this; if (name != 'socket.io') return target; + + /* + * socket.io v2 directly exports the function to be patched + * socket.io v3 & v4 exports a factory function, with a Class as .Server which can't be patched successfully by the code below + */ + if (target.Server) { + // don't attempt to patch v3+ + return target; + } + /* * Don't set __ddProbeAttached__ = true as we need to probe and return * the constructor each time