Question 1 · 1
You need to develop a chat application, which allows the display of emoticons and images together with text messages. How should you configure a WebSocket endpoints to receive both text and binary messages?
Choose one answer.
- Create two @onMessage methods in the same endpoint with appropriate parameter types.
- Define the @onMessage methods in your endpoint with Object as parameter and check the actual type in your code.
- You can achieve this only by creating separate WebSocket endpoints for each message type.
- Create two @onMessage methods, each with appropriate decoder attribute in the same endpoint.