Skip to content
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

Add data getter protocole for update token with data #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

VAV-MD
Copy link

@VAV-MD VAV-MD commented Oct 7, 2024

Since in other projects for the client (JS and Java where I noticed this) there is a token update via a dataGetter and on the project I am working on this was also necessary, I added a new protocol CentrifugeConnectionDataGetter which in its completion can accept an object of the Date type and there you can return as our back expects from us
I hope this will help others too

@@ -29,8 +29,12 @@ public protocol CentrifugeConnectionTokenGetter: NSObject {
func getConnectionToken(_ event: CentrifugeConnectionTokenEvent, completion: @escaping (Result<String, Error>) -> ())
}

public protocol CentrifugeConnectionDataGetter: NSObject {
func getConnectionData(_ event: CentrifugeConnectionTokenEvent, completion: @escaping (Result<Data, Error>) -> ())
Copy link
Member

@FZambia FZambia Oct 28, 2024

Choose a reason for hiding this comment

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

It should not accept CentrifugeConnectionTokenEvent, must be separate type.

(!token.isEmpty && config.tokenGetter != nil) {
let updateData = config.dataGetter != nil
let updateToken = config.tokenGetter != nil
if updateData {
Copy link
Member

@FZambia FZambia Oct 28, 2024

Choose a reason for hiding this comment

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

I do not see where token is updated in this case. Generally, I think a bit more code refactoring required for this feature to make the code easier to follow. It already was a bit hard to follow.

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