To do this, I used generic-type-guard package which generates both an interface AND a valid type guard from code.
With this, we are 100% sure that the messages we receive are validated at runtime!
The client cannot pass us an object that is invalid! \o/
This commit adds a '/metrics' endpoint in the API that can be exploited by Prometheus.
This endpoint returns:
- the number of connected sockets
- the number of users per room
- common NodeJS and system metrics
WARNING: this endpoint is public right now and should be protected
When a user connects or disconnects on the server, we log this (along the current server load).
This is only temporary, in order to assess the number of users a server can safely handle before crashing.