For the backend, we will use a WebSocket endpoint mapped to the URL /booking/{movieId}, as follows:
@ServerEndpoint(value = "/booking/{movieId}", encoders = {SeatsEncoder.class}) public class BookingEndpoint { ... }
Inside the endpoint class, we will define an in-memory database to simulate a database for all available movies. In a real-world implementation, the database would be too complex to maintain movies, available dates and cinemas, and seats for each combination in persistent storage. However, for the sake of simplicity, we will create a HashMap of Integer to boolean[][], where the key will be the movie ID, and the value a two-dimensional array of Boolean values, denoting whether the seat is ...