Hi, I wonder if someone could give me some guidance on the streaming API to which I am connected and receiving data, but it is seemingly fragmented.
What I mean by this, is that I am getting responses like this:
{“resource_kind”:“company-profile”,"reso…:“changed”}}
20-12-31",“period_end_on”:"2020-12-…“changed”}}
ting_reference_date":{“d…pe”:“changed”}}
I have truncated the message responses here for brevity. The first message is complete, then subsequent messages are partial but always end at the end of the JSON packet. The first part of the data is simply ‘missing’. At various stages, a full and complete message is received again, but followed by incomplete data.
This is my first time dealing with an open-ended stream and so I am obviously missing something.
This is my code - in .NET, using a HTTPWebRequest and Response
Connection…
Do
response = request.GetResponse()
Dim sr As New IO.StreamReader(response.GetResponseStream(), detectEncodingFromByteOrderMarks:=True)
Debug.Print(Await sr.ReadLineAsync)
Loop
Is reading the stream by line the culprit? If so, what is the correct way of pulling the data out of the stream?
Thanks in advance for any assistance on this.
Mark