Can't use Jsonify in Flask websocket Can't use Jsonify in Flask websocket flask flask

Can't use Jsonify in Flask websocket


In flask

jsonify is a response that sends a response with data in json format.

you can do it like this:

import json

then change ws.send to:

ws.send(json.dumps(dict(cpu=cpu, ram=ram, disk=disk)))