Add/decode payload callback

Added isLast tests in parser.js