javascript - Why does XHR Request To Azure Event Hub have improper message body? -


i sending ajax xhr message event hubs using javascript so...

    $.ajax({         type: "post",         url: eventhubconfig.servicebusuri + eventhubconfig.adhubname + "/messages/?timeout=60",         data: json.stringify(payload),         cache: false,         contenttype: "application/json",         beforesend: function(xhr) {             xhr.setrequestheader("authorization", sastoken);             xhr.setrequestheader("content-type", "application/json");         }     }); 

the payload simple object stringified json format like...

    var payload = {         platformid: 2,         articleid: 3,             ...             ...         type: "viewtype"     };  

the message when read event hub looks like.. correct message

occasionally receive message looks like... incorrect message

please note these both body of message after getting utf8 string microsoft.servicebus.messaging.eventdata object in c# backend so...

    var jsonstring = encoding.utf8.getstring(eventdata.getbytes()); 

any ideas on how possible event hub receive second message?


Comments