decoding messages and replying to ping