database websocket
documentation
This commit is contained in:
@@ -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:
|
||||
|
Reference in New Issue
Block a user