added websocket test flies
This commit is contained in:
27
backend/websocket/websocket_test_client.py
Normal file
27
backend/websocket/websocket_test_client.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright (c) 2019. Tobias Kurze
|
||||
|
||||
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!'
|
||||
|
||||
logging.basicConfig()
|
||||
|
||||
#socketio = SocketIO(message_queue="redis://")
|
||||
socketio = SocketIO(app)
|
||||
|
||||
#socketio.run(app, host="localhost", port=5000)
|
||||
#socketio.init_app(app, host="localhost", port=5000, cors_allowed_origins="*", )
|
||||
#socketio.init_app(app, host="localhost", port=5000, cors_allowed_origins="*", )
|
||||
|
||||
socketio.emit("server_event", {'data': 42, 'msg': 'toll'})
|
||||
print("sent message!")
|
||||
socketio.emit({'data': 42, 'msg': 'toll'})
|
||||
print("sent message 2!")
|
||||
Reference in New Issue
Block a user