Skip to content

LegallGuillaume/wSocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wSocket

Websocket communication with multiple channel

Installation    |    Development    |    Contributing

Installation

# 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 install

Development

import 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()

Contributing

Please make pull request

Author(s)

About

Python 3 Websocket communication with multiple channel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages