Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't emit package with empty binary field, ver 5.1.1 #257

Closed
ForJobsGit opened this issue Oct 20, 2021 · 1 comment
Closed

Can't emit package with empty binary field, ver 5.1.1 #257

ForJobsGit opened this issue Oct 20, 2021 · 1 comment
Assignees

Comments

@ForJobsGit
Copy link

Describe the bug
Can't emit package with empty binary field

To Reproduce

requirements.txt

gunicorn[gevent]==20.1.0
gevent-websocket==0.10.1
greenlet==1.1.2
Flask==2.0.2
Werkzeug==2.0.2
Jinja2==3.0.2
Flask-SocketIO==5.1.1
python-socketio[client]==5.4.1

server.py

import gevent.monkey
gevent.monkey.patch_all()

from datetime import datetime

from flask import Flask
from flask_socketio import SocketIO

flask_server = Flask(__name__)
flask_server.config['SECRET_KEY'] = 'test'

socket_io = SocketIO(flask_server, logger=True, engineio_logger=True)


@socket_io.on('upload_data')
def upload(*args):
    print(f'{datetime.utcnow()} upload_data {args}')

client.py

from datetime import datetime
import time
import socketio

sio = socketio.Client()
sio.connect(url='http://localhost:8080')

sio.emit(event='upload_data', data={'emit_at': str(datetime.utcnow()), 'binary': b''})

run

gunicorn  --bind=127.0.0.1:8080 --workers=1 --worker-class=geventwebsocket.gunicorn.workers.GeventWebSocketWorker server:flask_server

server logs

WHJ3PDQvATsZZBJdAAAC: Sending packet OPEN data {'sid': 'WHJ3PDQvATsZZBJdAAAC', 'upgrades': ['websocket'], 'pingTimeout': 20000, 'pingInterval': 25000}
WHJ3PDQvATsZZBJdAAAC: Received request to upgrade to websocket
WHJ3PDQvATsZZBJdAAAC: Upgrade to websocket successful
WHJ3PDQvATsZZBJdAAAC: Received packet MESSAGE data 0
WHJ3PDQvATsZZBJdAAAC: Sending packet MESSAGE data 0{"sid":"Yg88TtqALWtXfJxZAAAD"}
WHJ3PDQvATsZZBJdAAAC: Received packet MESSAGE data 51-["upload_data",{"emit_at":"2021-10-20 18:27:29.371042","binary":{"_placeholder":true,"num":0}}]
WHJ3PDQvATsZZBJdAAAC: Received packet NOOP data None

@ForJobsGit
Copy link
Author

Describe the bug
Can't emit package with empty binary field.

To Reproduce

requirements.txt

gunicorn[eventlet]==20.1.0
eventlet==0.30.2 # https://github.com/benoitc/gunicorn/pull/2581
greenlet==1.1.2
Flask==2.0.2
Werkzeug==2.0.2
Jinja2==3.0.2
Flask-SocketIO==5.1.1
python-socketio[client]==5.4.1

server.py

import eventlet
eventlet.monkey_patch()

from datetime import datetime

from flask import Flask
from flask_socketio import SocketIO

flask_server = Flask(__name__)
flask_server.config['SECRET_KEY'] = 'test'

socket_io = SocketIO(flask_server, logger=True, engineio_logger=True)


@socket_io.on('upload_data')
def upload(*args):
    print(f'{datetime.utcnow()} upload_data {args}')

client.py

from datetime import datetime
import time
import socketio

sio = socketio.Client()
sio.connect(url='http://localhost:8080')

sio.emit(event='upload_data', data={'emit_at': str(datetime.utcnow()), 'binary': b''})

run

gunicorn  --bind=127.0.0.1:8080 --workers=1 --worker-class=eventlet server:flask_server

server logs

qtQxmkax4c0mK-XxAAAC: Sending packet OPEN data {'sid': 'qtQxmkax4c0mK-XxAAAC', 'upgrades': ['websocket'], 'pingTimeout': 20000, 'pingInterval': 25000}
qtQxmkax4c0mK-XxAAAC: Received request to upgrade to websocket
qtQxmkax4c0mK-XxAAAC: Upgrade to websocket successful
qtQxmkax4c0mK-XxAAAC: Received packet MESSAGE data 0
qtQxmkax4c0mK-XxAAAC: Sending packet MESSAGE data 0{"sid":"49UFfA77lsFQjxp7AAAD"}
qtQxmkax4c0mK-XxAAAC: Received packet MESSAGE data 51-["upload_data",{"emit_at":"2021-10-20 22:27:49.703361","binary":{"_placeholder":true,"num":0}}]
qtQxmkax4c0mK-XxAAAC: Received packet NOOP data None


@miguelgrinberg miguelgrinberg self-assigned this Oct 20, 2021
@miguelgrinberg miguelgrinberg transferred this issue from miguelgrinberg/Flask-SocketIO Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants