Open kylebshr opened 8 years ago
UPDATE — just figured out how it works! The API feels a little confusing though, and I would propose a change.
This seems to do what I need:
socket.emitWithAck(EmitEvent.create, ["name": playerName])(timeoutAfter: 5) { data in
// do stuff
}
but this makes more sense in my opinion:
socket.emitWithAck(EmitEvent.create, ["name": playerName], timeout: 5) { data in
// do stuff
}
Yeah, the reason I did that is because variadic parameters have to be last. And I didn't like having the timeoutAfter before the emit data.
Hi @nuclearace I'm still figuring out how to use emitWithAck,, I'm very new to swift and socket (only started 2 days ago). I have this code in js
myApp.server.emit('auth/verify', req, function(error, data) { if ($.isFunction(callback)) { callback(myApp.app.error.process(error), data); } });
and in swift I do this socket.emitWithAck("auth/verify", req)(timeoutAfter:5, callback: {data in print(data)})
but seems like there is no data returned...
Am I going to the right direction? or its totally wrong?
Hello,
Just started using socketio in a swift game I'm developing. We'd like to ack back and forth on every event but I'm unsure of how to do this. There's an
emitWithAck
function, but it says to add ack handlers toSocketAckHandler
, which I can't find anywhere else in the code.I was hoping acks could just be completion blocks — this would be awesome:
but it seems that's not the case at all. I also noticed #11 is still open — does that mean acking isn't supported at all?
Thanks for the help!
Kyle