0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-03 04:02:47 +01:00

modules/client/rooms/messages: Chunk direct to socket.

This commit is contained in:
Jason Volk 2018-04-30 10:40:52 -07:00
parent 87f792b8eb
commit fb96f017b7

View file

@ -47,15 +47,27 @@ get__messages(client &client,
room, page.from room, page.from
}; };
//TODO: chunk directly to socket
const unique_buffer<mutable_buffer> buf const unique_buffer<mutable_buffer> buf
{ {
(1 + page.limit) * m::event::MAX_SIZE //TODO: XXX 96_KiB
}; };
json::stack out{buf}; resource::response::chunked response
{ {
json::stack::object ret{out}; client, http::OK
};
json::stack out{buf, [&response]
(const const_buffer &buf)
{
response.write(buf);
return buf;
}};
json::stack::object ret
{
out
};
// Spec sez the 'from' token is exclusive // Spec sez the 'from' token is exclusive
if(it && page.dir == 'b') if(it && page.dir == 'b')
@ -101,15 +113,8 @@ get__messages(client &client,
{ {
ret, "end", json::value{end} ret, "end", json::value{end}
}; };
}
return resource::response return {};
{
client, json::object
{
out.completed()
}
};
} }
// Client-Server 6.3.6 query parameters // Client-Server 6.3.6 query parameters