Skip to content

Acknowledgments do not seem to work on 1.0.3 #1575

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

Closed
sbstp opened this issue Jun 2, 2014 · 18 comments
Closed

Acknowledgments do not seem to work on 1.0.3 #1575

sbstp opened this issue Jun 2, 2014 · 18 comments

Comments

@sbstp
Copy link

sbstp commented Jun 2, 2014

I've been trying to get acknowledgments working, but nothing seems to work.

// client.js
var socket = io('http://localhost:3000');

// the event is fired
socket.on('connect', function () {
  console.log('connected');
});

this.startSearch = function (what, callback) {
  socket.emit('start', {what: what}, function (data) {
    // this is never called
    console.log(data); 
  });
};
// server.js
// connected socket, start is fired, typeof callback is function
socket.on('start', function (what, callback) {
  var search = service.search(what);
  callback({id: search.id});
}

I've inspected the socket frames and I can see the data being sent. But the client callback is never called.

Both the client script and the node module are at version 1.0.3.

@jamesrom
Copy link

jamesrom commented Jun 2, 2014

Further to this issue, it hangs the browser. The problem appears to be in the decodeString(str) function.

function decodeString(str) {
  var p = {};
  var i = 0;

  // look up type
  p.type = Number(str.charAt(0));
  if (null == exports.types[p.type]) return error();

  // look up attachments if type binary
  if (exports.BINARY_EVENT == p.type || exports.ACK == p.type) {
    p.attachments = '';
    while (str.charAt(++i) != '-') { // <-- problem here. non-terminating loop. str never contains '-'
      p.attachments += str.charAt(i);
    }
    p.attachments = Number(p.attachments);
  }
  ...

@Multiply
Copy link

Multiply commented Jun 2, 2014

We're having exactly this problem, across multiple browsers as well. They just hang.

I simply downgraded to 1.0.2

@ZloyDyadka
Copy link

+1

@rauchg
Copy link
Contributor

rauchg commented Jun 2, 2014

Looking into this!

@JGAntunes
Copy link

Same issue here. Execution freezes in the while loop @jamesrom mentioned.

@sbstp
Copy link
Author

sbstp commented Jun 2, 2014

I've just tried with 1.0.2 and the bug does not occur.

@kevin-roark
Copy link

hey all. I've looked into the issue a bit and it seems that the client build in 1.0.3 does not have the updated 2.2.0 socket.io-parser. this should be fixed very soon!

@alexiskattan
Copy link

@kevin-roark thanks you! Do you know when it will be fixed? Having the same issue here after going to 1.0.3. All the best!

@ashconnell
Copy link

Just letting yall know i have the same issue. Chrome on OSX hangs and requires a force quit if i use acknowledgements

@rauchg
Copy link
Contributor

rauchg commented Jun 3, 2014

1.0.4 incoming with the fixed build!

@rauchg
Copy link
Contributor

rauchg commented Jun 3, 2014

Also working on an enhanced release procedure to make sure this gets tested.

@ashconnell
Copy link

Perfect timing. I almost downgraded...

@JGAntunes
Copy link

@guille thanks! For when the release?

@rauchg
Copy link
Contributor

rauchg commented Jun 3, 2014

Right about… now!

@rauchg rauchg closed this as completed Jun 3, 2014
@sbstp
Copy link
Author

sbstp commented Jun 3, 2014

Thanks a lot for the fast response & bug fix.

@ashconnell
Copy link

Yep that fixed it for me! Legend on the fast update

@JGAntunes
Copy link

Fixed it! Thanks a lot.

@rauchg
Copy link
Contributor

rauchg commented Jun 3, 2014

Thanks @kevin-roark for the diagnosis!

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

9 participants