You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using cpp-httplib to watch server side events, instead of downloading some big files.
The interface looks like below while using curl
My code looks like below:
auto res = cli.Get("/events,watch=true", [&](constchar *data, size_t data_length) -> bool {
auto event = json_parse(data, data_length);
handle_event(event);
returntrue;
});
Each chunk stands for an event, but sometimes the event may be bigger than 4096, then it will be cut down, and json parse will fail.
I've seen the issue #1191, avoid to regard the data as a whole piece, but it's hard for me to distinguish the boundary of each event to put it together.
Do you have any good idea on it?
add another flag to indicate the chunk finished
increase the read buffer size
The text was updated successfully, but these errors were encountered:
I am using cpp-httplib to watch server side events, instead of downloading some big files.
The interface looks like below while using
![pic](https://private-user-images.githubusercontent.com/29170746/337093207-e4c15853-b898-4ba2-8b07-f146e527b12a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk4MTc0MDcsIm5iZiI6MTcxOTgxNzEwNywicGF0aCI6Ii8yOTE3MDc0Ni8zMzcwOTMyMDctZTRjMTU4NTMtYjg5OC00YmEyLThiMDctZjE0NmU1MjdiMTJhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzAxVDA2NTgyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMzYTdjNTI2OGRlMjRhNDk0NGQzZTlhZTgxYWYzMWQ0ZmE3MWJkYmZhODFkODkwNThhNDM2M2YwODIxZGFkNTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.BFk6K4Nj_9bX3YAq7ED3XzQ1CrE1PgZ4Izns3_dL3IM)
curl
My code looks like below:
Each chunk stands for an event, but sometimes the event may be bigger than 4096, then it will be cut down, and json parse will fail.
I've seen the issue #1191, avoid to regard the data as a whole piece, but it's hard for me to distinguish the boundary of each event to put it together.
Do you have any good idea on it?
The text was updated successfully, but these errors were encountered: