Amazon CloudFront WebSocket Support for SysOps Administrators

WebSocket Support with Amazon CloudFront for SysOps Administrators

Question

The Development Team is working on a real-time chatting application that will use Amazon CloudFront.

This application will be based on the WebSocket protocol.

Development team is concerned about the changes required to support this application. Which is the correct statement to have WebSocket support with Amazon CloudFront for a SysOps Administrator?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: D.

WebSocket is supported by default with Amazon CloudFront.

To establish connectivity using WebSocket, clients need to send an HTTP request with an upgrade protocol header.

The server responds to it, and connectivity over WebSocket protocol is established.

Options A and B are incorrect as WebSocket is supported on Amazon CloudFront by default; no additional configuration is required.

Option C is incorrect as to establish WebSocket connectivity, a client sends an HTTP request with an upgrade protocol header to which the server responds.

Servers do not initiate HTTP requests to establish WebSocket connectivity.

For more information on WebSocket with Amazon CloudFront, refer to the following URL,

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-working-with.websockets.html

To support WebSocket with Amazon CloudFront, the correct statement for a SysOps Administrator is:

C. Server needs to send an HTTP request with the upgrade protocol header.

WebSocket is a protocol that allows full-duplex communication between a client and a server over a single, long-lived connection. Amazon CloudFront is a content delivery network (CDN) that can cache and deliver content globally. To use WebSocket with Amazon CloudFront, the server needs to send an HTTP request with the upgrade protocol header.

When a client requests an object through CloudFront that uses the WebSocket protocol, CloudFront checks whether the request includes an upgrade header with a value of "websocket." If CloudFront detects this header, it forwards the request to the origin server with the upgrade header. The origin server then returns a 101 status code response to upgrade the protocol to WebSocket. Once the WebSocket protocol is established, CloudFront forwards all subsequent WebSocket traffic between the client and the origin server.

Enabling WebSocket is not a configuration option that needs to be set explicitly while creating a distribution. Instead, it is detected by CloudFront during runtime, when the server sends an HTTP request with the upgrade protocol header. Therefore, answer B. WebSocket needs to be enabled while creating distribution is not correct.

Finally, WebSocket doesn't need to be enabled globally with Amazon CloudFront, as stated in answer A. It is enabled on a per-request basis when the server sends an HTTP request with the upgrade protocol header. Also, the client does not need to send an HTTP request with the upgrade protocol header, as mentioned in answer D.

In summary, to support WebSocket with Amazon CloudFront, the server needs to send an HTTP request with the upgrade protocol header.