Events

noonjs.on(event, callback)

Registers a listener for key lifecycle and connection-related events emitted by the noonjs server. This allows for custom handling and logging during server operations.

...
   
noonjs.on("error", error => {
    console.log(error)
})

noonjs.on("started", port => {
    console.log(`✅ Server is running on http://localhost:${port}`)
})

...
  • "started" Triggered when the server has successfully started and is now listening for connections.
  • "stopped" Triggered when the server has been gracefully stopped and all resources have been released.
  • "error" Triggered when a critical error occurs during the server’s lifecycle. The callback receives the error object.
  • "mongodb-connected" Triggered when the MongoDB connection is successfully established.
  • "mongodb-disconnected" Triggered when the MongoDB connection is lost or intentionally closed.
  • "socket-connected" Triggered when a new Socket.IO client successfully connects.
  • "socket-disconnected" Triggered when a connected Socket.IO client disconnects.
Edit this page on Github
© 2025 kav3.com. Crafted with and dedication.