-
-
Notifications
You must be signed in to change notification settings - Fork 132
Added support for session token and user authentication. #60
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
Inspired by this issue: #40 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Sorry it's taken so long to get to this. IIRC, the original reason I left out sending One initial plan I had, was to have a single PFUser instance associated with a live query client, that could be passed on initialization (and the default client would use The issue with this, again, is logout. There's currently no way in the SDK to know when a user is logged out, and I had hoped that I would be able to invalidate all of the subscriptions when this occurred. With that said, this is a great first step! I've added a few more comments inline, that I'd like addressed before this gets merged. |
@@ -23,7 +23,7 @@ public class Client: NSObject { | |||
let clientKey: String? | |||
|
|||
var socket: SRWebSocket? | |||
var userDisconnected = false | |||
public var userDisconnected = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be made public - this only controls whether or not 'disconnect()' was explicitly called, and the person using the Client
should know this already, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use this property in my own project to automatically reconnect to the socket after the Internet connection is available again. Otherwise I don't know any way to know whether the client is connected or not.
@andrew8712 are you still up to take care of those nits so we can merge it and make it part of 1.1.1? |
@flovilmart Looks like my fork is pretty outdated. Would you be able to merge it or you want me to merge the fork from master first? My project uses this fork, and it's not migrated to Swift 3, so I didn't update the fork too. |
You'll probably need to rebase and update to swift 3. I'll let @richardjrossiii do the final review and merge as he had some concerns |
@andrew8712 we'll likely need to update to swift3, I could also add the support myself, but I don't like to take this good work for myself! So your call :) |
Added using of sessionToken for both Connect and Subscribe messages. sessionToken is taken from PFUser.currentUser() directly and passes only if it's not nil.
@flovilmart Done. unfortunately, I couldn't test the changes on my project, as it's still not migrated to Swft 3. |
Awesome! I'll have a look later today! |
That's looking great! We probably want to add a notification to the iOS SDK to notify login/logout events and listen to that to automatically refresh the subscriptions. |
@flovilmart Agree, that case should be definitely handled. |
@andrew8712 wanna make a PR on the iOS SDK to notify user logins/logout events? |
@flovilmart Parse iOS SDK is out of my scope at this moment :) |
alright I'Ll see what I can do then |
Added using of
sessionToken
for both Connect and Subscribe messages. sessionToken is taken from PFUser.currentUser() directly and passes only if it's not nil.Tested, works fine for me.