ssl – Principle of https communication between the client and the server based on a self-signed certificate

I have known traditional https communication principle between browser and server. Now I have configured a https communication demo between client and server based on self signed certificate, the demo is shown below.

The code in the server is displayed below,

import socket
import ssl
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv = ssl.wrap_socket(serv, keyfile='./privkey.pem', certfile='./certificate.pem', 
serv.bind(("", 4443))