Which code segment should you use?

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?

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:
https://www.tutorialspoint.com/html5/html5_websocket.htm



Leave a Reply 0

Your email address will not be published. Required fields are marked *