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

ValueError: Too many packets in payload #1228

Closed
DiaaZiada opened this issue Apr 1, 2020 · 1 comment
Closed

ValueError: Too many packets in payload #1228

DiaaZiada opened this issue Apr 1, 2020 · 1 comment

Comments

@DiaaZiada
Copy link

DiaaZiada commented Apr 1, 2020

I'm trying to make an app that sends a stream of images to the server from webcam
and I made those scripts to mimic the process by sending an array of 400x300x3 as image
but I got this error
ValueError: Too many packets in payload

client

import socketio
import time 

import numpy as np
import pickle

arr = np.random.randn(400,300,3)
arr = pickle.dumps(arr)
sio = socketio.Client()

@sio.event
def connect():
    print('connection established')

@sio.event
def my_message(data):
    print('message received with ', data)
    sio.emit('my response', {'response': 'my response'})

@sio.event
def disconnect():
    print('disconnected from server')

sio.connect('http://localhost:5000')

while True:
    # time.sleep(0.001)
    sio.emit("message",arr)
sio.wait()

server

from flask import Flask, render_template
from flask_socketio import SocketIO

app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)



import numpy as np
import pickle
arr = np.random.randn(300,400,3)
arr = pickle.dumps(arr)


@socketio.on('message')
def handle_message(message):
     socketio.emit("my_message", 'aaa')    

if __name__ == '__main__':
    socketio.run(app)
@miguelgrinberg
Copy link
Owner

This is a known limitation. See miguelgrinberg/python-engineio#142 for a workaround.

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