Giter Club home page Giter Club logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
So right now it sends a maximum of 32767 bytes in one call.  This would be 
fine, except that in the second call which would send the remaining bit of 
data, there are bytes missing as described here:

http://stackoverflow.com/questions/5857406/bytes-missing-between-websocket-calls

Original comment by [email protected] on 2 May 2011 at 2:14

from phpwebsocket.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Related issue, when onmessage is being called multiple times, every call except 
the first has its first byte missing.  No idea how to fix.  Also don't know 
what the purpose of the following line of code is the unwrap():

return substr($msg,1,strlen($msg)-2);

Why is it shaving off two characters at the end? Shouldn't it just shave off 
the the chr(255)?

Original comment by [email protected] on 3 May 2011 at 4:26

from phpwebsocket.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
[deleted comment]

from phpwebsocket.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Hi, I encounter the same issue and simply solve it by change the unwrap 
function to this :

  function  unwrap($msg=""){
    $firstChar = substr($msg,0,1);
    $lastChar = substr($msg,-1);
    if ($firstChar==chr(0) && $lastChar==chr(255))
      return substr($msg,1,strlen($msg)-2);
    elseif ($firstChar==chr(0))
      return substr($msg,1);
    else
      return substr($msg,0,strlen($msg)-1);
  }

this function should delete the chr(0) in the head and the chr(255) in the 
tail, but when a message is divided into several pieces, chr(0) and chr(255) in 
fact are not exist in each fragment 

Original comment by [email protected] on 9 May 2011 at 10:47

from phpwebsocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.