Python 2.X WebSocket Client
1 min read
python
Written in 2019. Tools, APIs and prices may have changed since.
Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/python-2.x-websocket-client-playground.
learn python websocket-client module
prerequisites
- python 2.x
- node.js: for local websocket server. code is from https://glitch.com/~socketio-basic. uses ws: a Node.js WebSocket library
- virtualenv:
pip install virtualenvorsudo pip install virtualenv
running
# server (node.js) - run in own terminal (blocking)
cd src/server
npm i
npm start
# client - run in separate terminal
cd src/client
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python client.py
example run
