add onrecv method to pipe