Skip to content

Commit

Permalink
fix: Offset Not Updated for Server-Side Subscriptions After Receiving…
Browse files Browse the repository at this point in the history
… Publications #107 (#108)

#107

---------

Co-authored-by: a.pochtarev <[email protected]>
  • Loading branch information
shalom-aviv and a.pochtarev authored Dec 4, 2024
1 parent b3ed837 commit da29c5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/SwiftCentrifuge/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,9 @@ fileprivate extension CentrifugeClient {
}
let pubEvent = CentrifugeServerPublicationEvent(channel: channel, data: pub.data, offset: pub.offset, tags: pub.tags, info: info)
self.delegate?.onPublication(self, pubEvent)
if self.serverSubs[channel]?.recoverable == true && pub.offset > 0 {
self.serverSubs[channel]?.offset = pub.offset
}
}
for (channel, _) in self.serverSubs {
if result.subs[channel] == nil {
Expand Down Expand Up @@ -758,7 +761,6 @@ fileprivate extension CentrifugeClient {
if subs.count == 0 {
subscriptionsLock.unlock()
if let _ = self.serverSubs[channel] {
// self.delegateQueue.addOperation {
var info: CentrifugeClientInfo? = nil;
if pub.hasInfo {
info = CentrifugeClientInfo(client: pub.info.client, user: pub.info.user, connInfo: pub.info.connInfo, chanInfo: pub.info.chanInfo)
Expand All @@ -768,7 +770,6 @@ fileprivate extension CentrifugeClient {
if self.serverSubs[channel]?.recoverable == true && pub.offset > 0 {
self.serverSubs[channel]?.offset = pub.offset
}
// }
}
return
}
Expand Down

0 comments on commit da29c5b

Please sign in to comment.