added permissions api and websocket stuff

This commit is contained in:
2019-11-28 19:39:53 +01:00
parent c4b54357f7
commit a709dbcaef
14 changed files with 229 additions and 24 deletions

View File

@@ -3,19 +3,23 @@
import logging
import threading
import time
from flask import Flask
from flask_socketio import SocketIO, emit
from backend import app
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
from socketIO_client import SocketIO, LoggingNamespace
logging.basicConfig()
token = "# replace with: JWT Access Token"
#print(token)
print("params")
#socketIO = SocketIO('127.0.0.1', 5443, params={'jwt': '{}'.format(token)})
print("headers")
#socketIO = SocketIO('127.0.0.1', 5443, headers={'Authorization': 'Bearer {}'.format(token)})
print("cookies")
socketIO = SocketIO('127.0.0.1', 5443, cookies={'access_token_cookie': '{}'.format(token)})
#socketio = SocketIO(message_queue="redis://")
socketio = SocketIO(app, port=5443, debug=True)
socketio = SocketIO('127.0.0.1', 5443)
#socketio.run(app, host="localhost", port=5000)
#socketio.init_app(app, host="localhost", port=5000, cors_allowed_origins="*", )
@@ -24,4 +28,4 @@ socketio = SocketIO(app, port=5443, debug=True)
socketio.emit("server_event", {'data': 42, 'msg': 'toll'})
print("sent message!")
socketio.emit({'data': 42, 'msg': 'toll'})
print("sent message 2!")
print("sent message 2!")