Add API to get number of active sockets

This commit is contained in:
Jonas L 2019-06-17 00:00:00 +00:00
parent 567c38271a
commit f617aebf1b
3 changed files with 18 additions and 3 deletions

View file

@ -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
}