detecting messages and sending pongs