Check for socket io exists before calling