Allow onClose to send final message reliabily
Add support for Encoder and Decoder