aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/disconnect.js
blob: 9e733fa1fecfedd150bb8dfbe3b2c3361e6d1b2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
  Description: This module will be directly called by the server event handler
               when a socket connection is closed or lost. It can calso be called
               by a client to have the connection severed.
*/

exports.run = async (core, server, socket, data) => {
  if (socket.channel) {
    server.broadcast({
      cmd: 'onlineRemove',
      nick: socket.nick
    }, { channel: socket.channel });
  }

  socket.terminate();
};

exports.info = { name: 'disconnect' };