mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-04 10:19:26 +02:00
Add API to get number of active sockets
This commit is contained in:
parent
567c38271a
commit
f617aebf1b
3 changed files with 18 additions and 3 deletions
|
@ -16,9 +16,18 @@
|
|||
*/
|
||||
|
||||
import { Router } from 'express'
|
||||
import { WebsocketApi } from '../websocket'
|
||||
|
||||
export const createAdminRouter = () => {
|
||||
export const createAdminRouter = ({ websocket }: {
|
||||
websocket: WebsocketApi
|
||||
}) => {
|
||||
const router = Router()
|
||||
|
||||
router.get('/status', (_, res) => {
|
||||
res.json({
|
||||
websocketClients: websocket.countConnections()
|
||||
})
|
||||
})
|
||||
|
||||
return router
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue