---
description: >-
  Command is a method that can be binded against unique string id and can be
  triggered from any where
---

# Commands

`Few use cases of commands are, Checking Server Stats, kicking a player, Logging active player count etc.`

### How to create a command

```csharp
static void Main(string[] args)
{
    IServer serverApp = new ServerApplication();
    serverApp.SetUp();
    
    // bind/add command
    serverApp.AddCommand("activeUsers", ()=>{
        FN.Logger.Info($"Users count: {FN.PeerCollection.GetPeers().Count}");
    });
    
    // trigger/execute command
    serverApp.ExecuteCommand("activeUsers");
    
    // get list(ids) of avaliable commands
    List<string>commands = serverApp.ListCommands();
    
    Run(serverApp);
    serverApp.TearDown();
}
```
