Codec
You can define custom payload Encoder
and Decoder
to support other formats like MessagePack.
This will reset the default JSON
codec.
function encode(msg) {
return {
value: JSON.stringify(msg),
error: null
}
}
function decode(msg) {
return {
value: JSON.parse(msg),
error: null
}
}
hemera.setClientEncoder(encode)
hemera.setClientDecoder(decode)
hemera.setServerEncoder(encode)
hemera.setServerDecoder(decode)