function handleData(event) { var buf = event.target.value.buffer; if (buf.byteLength >= 20 ) { // reading characteristic FFB1: var str = String.fromCharCode.apply(null, new Uint8Array(buf)); console.log('I got ' + str); } else { // reading characteristic FFB2: console.log(new Uint8Array(buf)); } }