Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

[draft] Update the User info in the Presence Channel call #401

Closed
wants to merge 3 commits into from

Conversation

MarGul
Copy link

@MarGul MarGul commented Jun 18, 2020

This PR is not fully complete yet because it lacks the essentials tests. I'm having a little bit trouble of how I should test this feature but wanted to create the PR first to see that it will be accepted before I spend too much time on it.

Basically what I've done here is to create an API route to update the current user_info in presence channels. This is a highly sought after feature in Pusher but they haven't implemented it yet. You can see it here: https://stackoverflow.com/questions/24874279/how-to-change-member-info-in-pusher and https://stackoverflow.com/questions/29207414/save-to-user-info-on-pusher-presence-channels.

Personally I need this because I'm storing data here that I need to keep in sync. The problem I have is if UserA logs in and sets his user_info to on_call => false and then when UserB logs in he will get the on_call => false data for UserA. If now UserA answers a call I send out a client event setting this data (on client side) to on_call => true for UserA. This all works good but if UserB now reloads his page he will get the initial user_info that was set when UserA authenticated which would be on_call => false.

By having an API to update the user_info state this solves my problem. When UserA accepts a call I update the state on my websocket server meaning that UserB (and every other User's joining) will now have an updated info on UserA where on_call => true.

Hope you would accept this Pull Request and if you do, maybe give me some pointer of how to write a good test for this functionality. Maybe I need unit test to see that the updateUserInfo function works properly or do it by a Controller test like I've started.

@MarGul MarGul marked this pull request as draft June 22, 2020 16:30
@rennokki
Copy link
Collaborator

@MarGul I know this is a draft PR, but we'll discuss it after #140 gets applied.

@rennokki rennokki added the postponed Will be postponed until further notice label Aug 13, 2020
@rennokki rennokki changed the title Ability to update the user presence channel info by an API call [draft] Update the User info in the Presence Channel call Aug 13, 2020
@MarGul
Copy link
Author

MarGul commented Aug 14, 2020

Thanks @rennokki for jumping on as a maintainer. Would be awesome to get this PR in.

@rennokki
Copy link
Collaborator

I have marked it as postponed until the 2.x comes to avoid conflicts pretty much under the hood: #447

@MarGul
Copy link
Author

MarGul commented Aug 14, 2020

Thanks. Do you have any perception of time until we can have a look at this PR and maybe get it merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
postponed Will be postponed until further notice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants