amazon-nova-samples
amazon-nova-samples copied to clipboard
(S2S sample-codes/websocket-nodejs) Active connections always 0
server.ts shows always 0 as active connections.
This is due to using the wrong way of calculating connections count
https://github.com/aws-samples/amazon-nova-samples/blob/6f5ab3f04ea3b77ad7c5a228cc5a1dafe662be86/speech-to-speech/sample-codes/websocket-nodejs/src/server.ts#L65-L68
It should be:
io.sockets.sockets.size
The setInterval should be moved outside of the callback, otherwise every new connection will create a new one.