Example #1
0
        public async Task <int> SendMessage(SocketAction message)
        {
            await StreamWriter.WriteLineAsync(message.Serialize());

            await StreamWriter.FlushAsync();

            return(1);
        }
Example #2
0
        public void ReadCallback(string message)
        {
            SocketAction socketAction = SocketAction.Deserialize(message);

            switch (socketAction.SocketActions)
            {
            case SocketActions.ServerLogin:
                break;

            case SocketActions.ServerSendMessage:
                AddMessage(socketAction.Message);
                break;

            case SocketActions.CommandUsuaris:
                AddMessage($"{Username}, hi ha {socketAction.Message} usuaris conectats.");
                break;
            }
            Console.WriteLine(message);
        }