Websocket communication with multiple channel
Installation | Development | Contributing
# clone the repo
$ git clone https://github.com/LegallGuillaume/wSocket.git
# change the working directory to wSocket
$ cd wSocket
# install the module
$ python3 setup.py installimport wSocket
import time
def channel_serv_0(data):
pass
def channel_cli_1(data):
pass
def broadcast_fn(data):
pass
serv = wSocket.WSoServ(url='127.0.0.1', port=8766, path="/socket", channel={'channel_0': channel_serv_0})
serv.start()
cli = wSocket.WSoClient(url='127.0.0.1', port=8766, path="/socket", broadcast=broadcast_fn, channel={'channel_1': channel_cli_1})
cli.connect()
time.sleep(2)
serv.send('channel_1', {"key", "value"})
serv.send('channel_1', "This is a message")
time.sleep(2)
cli.send('channel_0', "This is a answer!")
time.sleep(2)
cli.close()
serv.close()- Guillaume Le Gall - Initial work - LegallGuillaume