Pithikos / python-websocket-server

A simple fully working websocket-server in Python with no external dependencies
MIT License
1.14k stars 381 forks source link

Client closed connection why !!! #33

Closed ahmadRagheb closed 6 years ago

ahmadRagheb commented 6 years ago

hi , use this code at client side

timer = setInterval(
    function() {

        ctx.drawImage(video, 0, 0, video.videoWidth  , video.videoHeight );
        var data = canvas.get()[0].toDataURL('image/png', 1.0);
        // newblob = dataURItoBlob(data);
        // console.log(data);
        ws.send(data);
    }, 3850);

the thing is after the first msg it says :

Client closed connection. Client (1) left

why ? and when i change the time 3850 to something lower like 250 . it last longer ! I SEND IMAGES

hope there is away i can make server sync with client or write method at client side js to let the server know that client alive ?? don''t know .. im still beginner in websocket this is my first time using it

Pithikos commented 6 years ago

So you are sending images instead of text? Images is binary data which is not supported. Try turning them into base64 and sending that instead.

ahmadRagheb commented 6 years ago

thanks it was a missing code at my side