| 175 | } |
| 176 | |
| 177 | ccstd::string SocketIOPacket::stringify() const { |
| 178 | ccstd::string outS; |
| 179 | if (_type == "message") { |
| 180 | outS = _args[0]; |
| 181 | } else { |
| 182 | rapidjson::StringBuffer s; |
| 183 | rapidjson::Writer<rapidjson::StringBuffer> writer(s); |
| 184 | |
| 185 | writer.StartObject(); |
| 186 | writer.String("name"); |
| 187 | writer.String(_name.c_str()); |
| 188 | |
| 189 | writer.String("args"); |
| 190 | |
| 191 | writer.StartArray(); |
| 192 | |
| 193 | for (const auto &item : _args) { |
| 194 | writer.String(item.c_str()); |
| 195 | } |
| 196 | |
| 197 | writer.EndArray(); |
| 198 | writer.EndObject(); |
| 199 | |
| 200 | outS = s.GetString(); |
| 201 | |
| 202 | CC_LOG_INFO("create args object: %s:", outS.c_str()); |
| 203 | } |
| 204 | |
| 205 | return outS; |
| 206 | } |
| 207 | |
| 208 | SocketIOPacketV10x::SocketIOPacketV10x() { |
| 209 | _separator = ""; |
no test coverage detected