Wraps socket.io event handlers to prevent crashes from certain malicious inputs.