implementing the readBuffer to handle multipart messages