From a2ff97d7fbbe4b7a0a9796e6cdb0bc38fa35e3da Mon Sep 17 00:00:00 2001 From: Bram Barbieri Date: Thu, 14 Mar 2024 18:46:46 +0100 Subject: [PATCH] database websocket documentation --- docs/rpi-documentation/Databaseconnection.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/rpi-documentation/Databaseconnection.md b/docs/rpi-documentation/Databaseconnection.md index 0372d01..de44bb4 100644 --- a/docs/rpi-documentation/Databaseconnection.md +++ b/docs/rpi-documentation/Databaseconnection.md @@ -1,13 +1,19 @@ ## Python code + explaination +We wanted to make a working connection between our websocket wich runs all the data gatherd by our nodes and a live feed to our database. +So we set out to make this connection using python. + +At first we needed to import the folowing librarys: ```js -// Here different librarys are imported to // everything is running async so the code can run together and not interfere with eachother. import asyncio import websockets // a library to connect to the database. import mysql.connector import json +``` +Then we began the process of connecting with both the websocket and the database. +```js //the data that has to be pushed needs to be async def process_data(data): try: