code: def my_on_connect(client):
      
      client.send('You connected from %s\n' % client.addrport())
      if CLIENTS:
          client.send('Also connected are:\n')
          for neighbor in CLIENTS:
              client.send('%s\n' % neighbor.addrport())
      else:
          client.send('Sadly, you are alone.\n')
      CLIENTS.append(client)
docs: Example on_connect handler.