Cloudfront with Websocket connection

I have been reading over the documentation here on connection a websocket service with a client through a cloudfront distribution but I am unable to understand where the upgrade to the websocket protocol will occur. Will the upgrade need to be handled by the server or will the cloudfront distribution handle changing the protocol to wss and respond with the connection?