socket.io server. code example
Example 1: socket
import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen()
conn, addr = s.accept()
with conn:
print('Connected by', addr)
while True:
data = conn.recv(1024)
if not data:
break
conn.sendall(data)
Example 2: socket..io
<script src="https://cdn.socket.io/socket.io-3.0.1.min.js"></script>