Kp/fix socket io timeout issues

we've seen our deployment get stuck in infinite loops on socket io.  These error checks prevent an infinite loop when the socket is null or when the socket_read returns false before the read is finished.