-
Notifications
You must be signed in to change notification settings - Fork 856
add SocketAckEmitter.expected to indicate if an ack is expected by server #557
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
Conversation
@@ -44,6 +44,10 @@ public final class SocketAckEmitter : NSObject { | |||
|
|||
socket.emitAck(ackNum, with: items) | |||
} | |||
|
|||
public func isRequired() -> Bool { | |||
return ackNum != -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semicolons are bad
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"
One last thing, this should opened against development rather than master. |
@@ -44,6 +44,10 @@ public final class SocketAckEmitter : NSObject { | |||
|
|||
socket.emitAck(ackNum, with: items) | |||
} | |||
|
|||
public func isExpected() -> Bool { |
There was a problem hiding this comment.
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.
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