public void HandleReceivedMessage(Message message) { if (message is SearchRequest) { SearchResponse searchResponse = GetSearchResponse((SearchRequest)message); foreach (ConnectedClient connectedClient in clientsList) { if (connectedClient.ClientID == searchResponse.ClientID) { connectedClient.TcpSocket.Send(MessageSerializer.Serialize(searchResponse)); } } } if (message is UpdateBookListRequest) { UpdateBookListRequest updateBookListRequest = (UpdateBookListRequest)message; foreach (ConnectedClient connectedClient in clientsList) { if (connectedClient.ClientID == updateBookListRequest.ClientID) { connectedClient.ClientBookList = updateBookListRequest.NewBookList; } } } }
public void SendMessage(BookShopLibrary.Message message) { TcpSocket.Send(ClientMessageSerializer.Serialize(message)); }