Add keepalive comment messages, per spec
This commit is contained in:
16
stream.cc
16
stream.cc
@@ -19,11 +19,10 @@ void Stream::OnClose(const std::function<void()>& callback) {
|
||||
on_close_ = callback;
|
||||
}
|
||||
|
||||
bool Stream::WriteEvent(const std::string& data, uint64_t id, const std::string& type) {
|
||||
{
|
||||
std::lock_guard l(mu_);
|
||||
index_->Freshen(this);
|
||||
}
|
||||
bool Stream::WriteEvent(const std::string_view& data, uint64_t id, const std::string& type) {
|
||||
std::lock_guard l(mu_);
|
||||
|
||||
index_->Freshen(this);
|
||||
|
||||
return request_->InTransaction<bool>([=]() {
|
||||
if (id) {
|
||||
@@ -37,6 +36,13 @@ bool Stream::WriteEvent(const std::string& data, uint64_t id, const std::string&
|
||||
});
|
||||
}
|
||||
|
||||
bool Stream::WriteRaw(const std::string_view& data) {
|
||||
std::lock_guard l(mu_);
|
||||
|
||||
request_->WriteBody(data);
|
||||
return request_->Flush();
|
||||
}
|
||||
|
||||
bool Stream::End() {
|
||||
return request_->End();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user