Skip to content

Conversation

naderio
Copy link
Contributor

@naderio naderio commented Oct 28, 2016

this is needed to send acknowledgement when required and to make NativeScript implementation mimic JavaScript's https://github.com/naderio/nativescript-socket.io/blob/64630685f2a000c79e116ed9e07662638bc32456/socket.ios.ts#L82

@@ -44,6 +44,10 @@ public final class SocketAckEmitter : NSObject {

socket.emitAck(ackNum, with: items)
}

public func isRequired() -> Bool {
return ackNum != -1;
Copy link
Member

@nuclearace nuclearace Oct 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

semicolons are bad

Copy link
Member

@nuclearace nuclearace Oct 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a computed property rather than a method.

public var isRequired: Bool {
    return ackNum != -1
}

But to take a step back. I don't remember required acks being a thing. Were they recently added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the JavaScript API, when an event expecting an ack is sent by server, the client provides the ack callback as last argument in event handler.
not a way to "require" an ack .. more like "an ack is expected"

@naderio naderio changed the title add SocketAckEmitter.isRequired() to indicate if an acknowledgement is required by server add SocketAckEmitter.isExpected() to indicate if an ack is expected by server Oct 28, 2016
@nuclearace
Copy link
Member

One last thing, this should opened against development rather than master.

@naderio naderio changed the base branch from master to development October 28, 2016 14:20
@@ -44,6 +44,10 @@ public final class SocketAckEmitter : NSObject {

socket.emitAck(ackNum, with: items)
}

public func isExpected() -> Bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should still be a computed property.

@naderio naderio changed the title add SocketAckEmitter.isExpected() to indicate if an ack is expected by server add SocketAckEmitter.expected to indicate if an ack is expected by server Oct 28, 2016
@nuclearace nuclearace merged commit 51ee965 into socketio:development Oct 28, 2016
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

Successfully merging this pull request may close these issues.

2 participants