예제 #1
0
        public static async Task <bool> SendResponseAsync(SerializationAdapterAsync clientMainSerializer, bool success, string message)
        {
            string response = String.Format("{0}{1}",
                                            success ? "ack" : "nack",
                                            String.IsNullOrWhiteSpace(message) ? "" : ":" + message); // add : delimiter only if there is an actual message

            return(await clientMainSerializer.SerializeAsync(response));
        }
예제 #2
0
        public async Task <bool> SendEvent_Disconnect(SerializationAdapterAsync clientEventSerializer)
        {
            string commandString = "event_disconnect";

            return(await clientEventSerializer.SerializeAsync(commandString));

            // There will be no response from client.
        }
예제 #3
0
 public FtClient(SslStream sslClient)
 {
     Client            = sslClient;
     m_readAllHelper   = new ReadAggregatorWritePassthrough(sslClient);
     Serializer        = new SerializationAdapter(m_readAllHelper);
     SerializerAsync   = new SerializationAdapterAsync(m_readAllHelper);
     Deserializer      = new DeserializationAdapter(m_readAllHelper);
     DeserializerAsync = new DeserializationAdapterAsync(m_readAllHelper);
 }
예제 #4
0
        protected async Task <bool> sendEvent_RoomDeleted(SerializationAdapterAsync clientEventSerializer, string roomName)
        {
            string commandString = String.Format("event_room_deleted:{0}", roomName);

            return(await clientEventSerializer.SerializeAsync(commandString));
        }
예제 #5
0
        protected async Task <bool> sendEvent_MessagePersonal(SerializationAdapterAsync clientEventSerializer, string fromUsername, string messageText)
        {
            string commandString = String.Format("event_message_personal:{0}:{1}", fromUsername, messageText);

            return(await clientEventSerializer.SerializeAsync(commandString));
        }