Streaming data
Fetching the stream of data
HTTPAPI's
source: https://refactoring.guru/design-patterns/observer

source: 8bitwork.com
#!/usr/bin/python
import socket
HOST = 'rtd.hpwren.ucsd.edu' # The remote host
PORT = 12020
def isOpen(ip,port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((ip, int(port)))
d = s.recv(1024).decode('utf-8')
print(d)
return True
except Exception as e:
print(e)
return False
finally:
s.close()
while True:
print(isOpen(HOST, PORT))
sleep(5)
Observer
MQTT

Callback
Last updated