private string ProcessSlashCommand(ChatState userState, ISessionData session, ISocketClient client, ref byte[] bytes)
        {
            byte[]        tmpBytes;
            ISlashCommand command = null;

            foreach (var cmd in userState.Commands)
            {
                tmpBytes = cmd.Identifier;
                if (bytes.IndexOfSequence(ref tmpBytes) > -1)
                {
                    command = cmd;
                }
            }

            if (command != null)
            {
                var content = bytes.Skip(command.Identifier.Length)
                              .Take(bytes.Length - command.Identifier.Length)
                              .ToArray();

                command.Execute(ref content, _serverState, session, client);
                return(string.Empty);
            }

            return("Invalid slash command.");
        }
        protected override void WhenClientConnects(ISocketClient client)
        {
            var newUser = new ChatState(client);

            if (!_clientStates.TryAdd(client, newUser))
            {
                return;
            }

            if (!_allowAnonymous)
            {
                newUser.Flags |= ChatStates.Authenticating;
            }

            client.Send(Encoding.UTF8.GetBytes(_welcomeMessage));
        }