https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
m

melodic-pencil-54185

05/18/2023, 12:26 PM
How can I listen to Growthbook-proxy using Swift? I couldn't find any samples on the documentation, or any public APIs that look like what I need.
f

fresh-football-47124

05/18/2023, 1:48 PM
@happy-autumn-40938 is this supported?
h

happy-autumn-40938

05/18/2023, 4:20 PM
Not currently. Streaming/proxy support is still fairly new, and we only officially support streaming in the JS and React SDKs
You can roll your own subscription listener if you’d like though. I could provide some guidance on what you’d need to do
m

melodic-pencil-54185

05/18/2023, 8:44 PM
I'm currently preparing a Proof of Concept at the company where I work. I would greatly appreciate any guidance or advice, even if it's just to help me estimate the effort required @happy-autumn-40938
f

fresh-football-47124

05/18/2023, 9:51 PM
For a POC you could consider just using the regular cdn method
h

happy-autumn-40938

05/18/2023, 10:00 PM
Full disclosure, I am not hugely familiar with the Swift SDK. But it seems like you should be able to get something working with a bit of effort. High level... 1. Streaming (via the proxy) relies on Server Sent Events. You will need some code that lives alongside your SDK to subscribe to your steaming endpoint. There is a GET endpoint on the proxy for subscribing using SSE of the form
https://<proxyurl>/sub/sdk-abcd1234
2. On streaming updates, you would need to manually update the SDK with the latest features. I believe you'd use the SDK's public method
featuresFetchedSuccessfully(features, isRemote)
to pass down the latest features.
Some info I found about using event source in Swift. I think your implementation would be much simpler though, no passed headers, only one type of callback. https://nickarner.com/notes/working-with-server-sent-events-in-swift-november-16-2021/
m

melodic-pencil-54185

05/19/2023, 7:38 AM
I'll give a try thanks @happy-autumn-40938 and @fresh-football-47124. Really appreciate
9 Views