Here's a simple websocket server that I found on github, which I modified very slightly.
Here is a simple class that is used to fetch data from a SQLite database for a python app