32 lines
980 B
Python
32 lines
980 B
Python
# Copyright (c) 2019. Tobias Kurze
|
|
|
|
import logging
|
|
import threading
|
|
import time
|
|
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('127.0.0.1', 5443)
|
|
|
|
#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!")
|