GetStream / stream-swift

Swift client for Stream API
https://getstream.io
BSD 3-Clause "New" or "Revised" License
35 stars 26 forks source link

Subscribe to new updates #49

Open jaydipdeveloper opened 7 months ago

jaydipdeveloper commented 7 months ago

I have a project in that we have page called community when all user can post so I need to subscribe to get updates

let userFeed = Client.shared.flatFeed(feedSlug: "community", userId: community_id_here)

userFeed.subscribe(typeOf: GetStreamActivity.self, subscription: { result in switch result { case .success(let activities): // Handle received activities print("Received activities: (activities)") case .failure(let error): // Handle subscription error print("Failed to subscribe: (error)") } })

        This never print  Received activities or Failed to subscribe

        Please help me
jaydipdeveloper commented 7 months ago

let userFeed = Client.shared.flatFeed(feedSlug: "user", userId: celebrity.memberId.uuidString.lowercased()) userFeed.callbackQueue = .main userFeed.subscribe(typeOf: Activity.self) { result in switch result { case .success(let activities): // Handle received activities print("Received activities: (activities)") case .failure(let error): // Handle subscription error print("Failed to subscribe: (error)") } }

    still not working