To achieve this, I successfully implemented the socket.io listener by intercepting the onevent method of connected sockets and then cross-referencing the emit event name with the events that the socket is set to listen for:
(Please note: The code provided is for the server-side implementation. For client-side usage, make sure to utilize _callbacks and remove the '$' from the beginning of each key)
io.on('connection', (socket)=>{
var onevent = socket.onevent;
var eventNames = Object.keys(socket._events);
socket.onevent = function (packet) {
onevent.call(this, packet);// original call
var eventName = packet.data[0];
if(eventNames.indexOf(eventName) == -1){
console.error('No handler for emitted event: '+eventName);
}
};
});