You develop an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code:
You need to post messages by using the HTML5 WebSocket API.
Which code segment should you use?
A. socket.onmessage($(-#message-).val());
B. socket.send($(-#message-).val());
C. var msg = $(-#message-).val();$.post(socket, function (msg) { -¦ });
D. var msg = $(-#message-).val();$.post(socket.onmessage, function (msg) { -¦ });
Explanation:
References: https://www.tutorialspoint.com/html5/html5_websocket.htm