Api / JavaScript /

Node.on('disconnect', callback)

Event emmited when a node is disconnected. When a node is connected via listen() the disconnected event only emmits when server calls disconnect(). Or when timeout is reached on transports that use it.

Arguments

'disconnect' String

callback Function

Example

const server = dop.connect()
server.on('connect', () => console.log('Connected!') )
server.on('disconnect', () => console.log('Disconnected!') )
As server
const listener = dop.listen()
listener.on('connect', node => {
    console.log('New node connected!')
    node.on('disconnect', () => console.log('Disconnected!') )
})

See also