Added hub code
This commit is contained in:
parent
954550408d
commit
83ffa9bd49
22
src/hub/hub.py
Normal file
22
src/hub/hub.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
"""
|
||||
Creates hub for distributed IoT
|
||||
|
||||
@author hornetfighter515
|
||||
@author Lachezar Todorov
|
||||
"""
|
||||
|
||||
from websocket_server import WebsocketServer
|
||||
|
||||
def new_client(client, server):
|
||||
print("Client has joined")
|
||||
|
||||
def message_received(client, server, message):
|
||||
print(message)
|
||||
|
||||
int_server = WebsocketServer(host='127.0.0.1', port=6872)
|
||||
|
||||
|
||||
ext_server = WebsocketServer(host='127.0.0.1', port=6873)
|
||||
ext_server.set_fn_message_received(message_received)
|
||||
ext_server.set_fn_new_client(new_client)
|
||||
ext_server.run_forever()
|
Loading…
Reference in New Issue
Block a user