Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove Starscream Dependency and bump minimum support platform #11

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

grdsdev
Copy link
Contributor

@grdsdev grdsdev commented Sep 5, 2022

This PR bumps the minimum supported platforms to:

  platforms: [
    .macOS(.v10_15),
    .iOS(.v13),
    .watchOS(.v6),
    .tvOS(.v13),
  ],

That make's it possible to remove the Starscream dependency.

@johndpope
Copy link

johndpope commented Sep 5, 2022

so using this demo bazel example branch -
https://github.com/wweevv-johndpope/DemoBazel/tree/gotrue-swift

Screen Shot 2022-09-06 at 7 04 47 am

Screen Shot 2022-09-06 at 7 04 36 am

this line spits out the build
swift create-xcframework Realtime --platform ios

Screen Shot 2022-09-06 at 7 04 18 am

I drag across - the branch I have is using a local supabase swift files in repo (I did that to get around crash before in other ticket) -also helps so I don't need to push to git / tag / publish release

Screen Shot 2022-09-06 at 7 06 43 am

I generate xcode project

./xcodegen app

Screen Shot 2022-09-06 at 7 10 48 am

I do a clean on xcode to make sure realtime frameworks are flushed

but I'm afraid - no changes are showing when I add a row of data.

EDIT
The db is connecting - and it selects rows of data fine
Screen Shot 2022-09-06 at 7 13 38 am

I set a breakpoint for on changes - but nothing hits

Correction -
there's an initial message on connecting - but not on any insert

Screen Shot 2022-09-06 at 7 15 56 am

Just confirming this is definitely your pull request code that's been built.
Screen Shot 2022-09-06 at 9 56 03 am

I'm seeing the heart beat -



OSStatus error:[-34018] Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements.
2022-09-06 10:15:15.429549+1000 ios_app[9920:81151] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics
2022-09-06 10:15:15.433011+1000 ios_app[9920:81150] [boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed to log metrics
🔖 message
["status": ok, "response": {
    "postgres_changes" =     (
                {
            id = 66434647;
            schema = "*";
        }
    );
}]
reply
Optional("ok")
[App_App_Classes.AppDelegate.TestClass(id: Optional(1)), App_App_Classes.AppDelegate.TestClass(id: Optional(23)), App_App_Classes.AppDelegate.TestClass(id: Optional(26)), App_App_Classes.AppDelegate.TestClass(id: Optional(27)), App_App_Classes.AppDelegate.TestClass(id: Optional(2)), App_App_Classes.AppDelegate.TestClass(id: Optional(3)), App_App_Classes.AppDelegate.TestClass(id: Optional(29)), App_App_Classes.AppDelegate.TestClass(id: Optional(31)), App_App_Classes.AppDelegate.TestClass(id: Optional(32)), App_App_Classes.AppDelegate.TestClass(id: Optional(11)), App_App_Classes.AppDelegate.TestClass(id: Optional(222)), App_App_Classes.AppDelegate.TestClass(id: Optional(125)), App_App_Classes.AppDelegate.TestClass(id: Optional(126)), App_App_Classes.AppDelegate.TestClass(id: Optional(111)), App_App_Classes.AppDelegate.TestClass(id: Optional(112)), App_App_Classes.AppDelegate.TestClass(id: Optional(1111))]
☕️
["topic": 1234:*, "status": ok, "message": subscribed to realtime]
all
Optional("ok")
🔖 message
["topic": 1234:*, "status": ok, "message": subscribed to realtime]
all
Optional("ok")
🔖 message
["status": ok, "response": {
}]
reply
Optional("ok")
🔖 message
["response": {
}, "status": ok]
reply
Optional("ok")
🔖 message
["response": {
}, "status": ok]
reply
Optional("ok")


    private var client:SupabaseClient?
    var database:PostgrestClient?
    var realtimeClient:RealtimeClient?
    
    private let supabaseUrl = "https://1234.supabase.co"
    private let supabaseKey = "1234.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBxeGN4bHR3b2lmbXhjbWhnaHpmIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NjAxODczNDQsImV4cCI6MTk3NTc2MzM0NH0.NiufAQmZ3Oy7eP7wNWF-tvH-e2D-UIz-vPLpLAyDMow"


    struct TestClass: Codable {
        var id: Int?
    }
    
    var allUsersUpdateChanges:Realtime.Channel?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        self.window = UIWindow(frame: UIScreen.main.bounds)
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let rootVC = storyboard.instantiateInitialViewController()
        self.window?.rootViewController = rootVC
        self.window?.makeKeyAndVisible()

    

        let rt = RealtimeClient(endPoint: "https://1234.supabase.co/realtime/v1", params: ["apikey": supabaseKey])
        rt.connect()
        rt.onOpen {
           
            self.allUsersUpdateChanges =  rt.channel(.all)//rt.channel(.table("test", schema: "public"))
            self.allUsersUpdateChanges?.on(.all) { message in
                print("☕️")
                print(message.payload)
                print(message.event)
                print(message.status)
            }
            self.allUsersUpdateChanges?.subscribe()
        }
        self.realtimeClient = rt
        self.realtimeClient?.onError{error in
            print("🔥 error")
            print(error)
        }
        self.realtimeClient?.onMessage{message in
            print("🔖 message")
            print(message.payload)
            print(message.event)
            print(message.status)
//            print(message.joinRef)
            
        }
      
//        allUsersUpdateChanges.unsubscribe()
//        allUsersUpdateChanges.off(.update)
        
               let client = SupabaseClient(supabaseURL:URL(string: supabaseUrl)!, supabaseKey: supabaseKey)
                let database = PostgrestClient(url: "\(supabaseUrl)/rest/v1", headers: ["apikey":supabaseKey], schema: "public")
        //
                self.client = client
                self.database = database
        //
                self.database?.from("test").select().execute() { result in
                    switch result {
                    case let .success(response):
                        do {
                            let feedback = try response.decoded(to: [TestClass].self)
                            print(feedback)
                        } catch {
                            print(error.localizedDescription)
                        }
                    case let .failure(error):
                        print(error.localizedDescription)
                    }
                }
        //

        
        return true
    }

I pushed updates to
https://github.com/wweevv-johndpope/DemoBazel/tree/gotrue-swift

So either the server is not correctly sending the update down the wire - or the update is sent - but it's not being received correctly. I can attach Charles debugger and see if I can inspect traffic.

@johndpope
Copy link

johndpope commented Sep 6, 2022

so - I https://github.com/supabase/realtime-js clone this - use my instance

var socket = new RealtimeClient("https://1234.supabase.co/realtime/v1", { params: { apikey: "1234.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBxeGN4bHR3b2lmbXhjbWhnaHpmIiwicm9sZSI6ImFub24iLCJpYXQiOjE2NjAxODczNDQsImV4cCI6MTk3NTc2MzM0NH0.NiufAQmZ3Oy7eP7wNWF-tvH-e2D-UIz-vPLpLAyDMow" }})

it connects fine - but I don't see updates coming down ....
Screen Shot 2022-09-06 at 10 38 20 am

This instance was shut down / paused by Ant. - Not sure if that's causing this problem.
I have access to another supabase instance - will try that.

@GRSouza -
Could you try using this branch with an instance of your own and see if it works?

I'm seeing traffic on realtime in dashboard - not sure why I don't get the notification on insert
Screen Shot 2022-09-06 at 10 52 40 am

@johndpope
Copy link

So this working for me.

@grdsdev grdsdev marked this pull request as ready for review September 13, 2022 08:32
@grdsdev grdsdev merged commit 0b985c6 into main Sep 13, 2022
@grdsdev grdsdev deleted the remove-starscream branch September 13, 2022 08:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants