Skip to content

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

}

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.

@FZambia
Copy link
Member

FZambia commented Feb 15, 2025

During last days I was thinking that getter protocols for data is not the best approach to use in our SDKs 🤔 It makes sense for tokens, but for data/headers it's much simpler to just provide Client.setData and Client.setHeader methods.

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