onIdle abstract method

void onIdle(
  1. void onIdle()
)

Specifies a callback called when the server is idle, i.e.,

  • not serving any requests (connectionCount is 0).
  • It is useful if you'd like to stop the server gracefully:
  • server.onIdle(() => server.stop());
    
  • In additions, you can do some house cleaning here too.

Implementation

void onIdle(void onIdle());