Checking result type in emit handler. Socket emit handler crashes when it tries to parse result which is already an Object.