修改clientID不存在时返回code
This commit is contained in:
@ -31,7 +31,7 @@ router.post('/', (req, res) => {
|
|||||||
if (client_id) {
|
if (client_id) {
|
||||||
const clientRes = clients.get(client_id);
|
const clientRes = clients.get(client_id);
|
||||||
if (!clientRes) {
|
if (!clientRes) {
|
||||||
return res.status(404).json({ error: `Client ${client_id} not found` });
|
return res.status(200).json({ error: `Client ${client_id} not found` });
|
||||||
}
|
}
|
||||||
|
|
||||||
clientRes.write(`data: ${JSON.stringify(payload)}\n\n`);
|
clientRes.write(`data: ${JSON.stringify(payload)}\n\n`);
|
||||||
|
@ -23,6 +23,7 @@ router.get('/', (req, res) => {
|
|||||||
res.write(`data: ${JSON.stringify({
|
res.write(`data: ${JSON.stringify({
|
||||||
status: 'connected',
|
status: 'connected',
|
||||||
clientId,
|
clientId,
|
||||||
|
clientCount: clients.size(),
|
||||||
time: timestamp.formatTime()
|
time: timestamp.formatTime()
|
||||||
})}\n\n`);
|
})}\n\n`);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user