Handling pongs, queries and replies