Identify two valid WebSocket message types for which you can register handlers.
(Choose two.)
Click on the arrows to vote for the correct answer
A. B. C. D.BC.
https://docs.oracle.com/javaee/7/api/javax/websocket/Session.htmlWebSocket is a protocol that allows for bi-directional, full-duplex communication between a client and server over a single TCP connection. Java EE 7 introduced the WebSocket API for developing real-time, web-based applications. When using the Java WebSocket API, you can register handlers to handle different types of WebSocket messages. The following are the valid WebSocket message types for which you can register handlers:
Binary Message: A binary message is a message containing binary data. You can register a binary message handler to handle incoming binary messages sent from the client. The handler must implement the javax.websocket.MessageHandler.Whole<ByteBuffer>
or javax.websocket.MessageHandler.Partial<ByteBuffer>
interface depending on whether the handler can handle the whole message or only part of it.
Ping Message: A ping message is a control frame sent by the server to the client to check if the connection is still alive. You can register a ping message handler to handle incoming ping messages sent from the server. The handler must implement the javax.websocket.MessageHandler.Pong<ByteBuffer>
interface.
Therefore, the correct answers to this question are B. Binary Message and D. Ping Message. It is important to note that error messages are not valid WebSocket message types, and pong messages are not messages that you can register a handler for, but rather a response sent by the client to a ping message from the server.