libhv icon indicating copy to clipboard operation
libhv copied to clipboard

lmj010308 fixed /http/server/HttpResponseWriter.cpp 使用SSEvent时,当event 为空指针时,不加event参数

Open lmj010308 opened this issue 1 year ago • 0 comments

int HttpResponseWriter::SSEvent(const std::string& data, const char* event /* = "message" */) { if (state == SEND_BEGIN) { EndHeaders("Content-Type", "text/event-stream"); } std::string msg=""; if(event != nullptr){ msg = "event: "; msg += event; msg += "\n"; } msg += "data: "; msg += data; msg += "\n\n"; state = SEND_BODY; return write(msg); }

lmj010308 avatar May 09 '24 09:05 lmj010308