Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

long form vs shortcut #8

Open
rolinger opened this issue Jun 12, 2019 · 6 comments
Open

long form vs shortcut #8

rolinger opened this issue Jun 12, 2019 · 6 comments

Comments

@rolinger
Copy link
Collaborator

Finally got this working using the below:

$client = new \Fcm\FcmClient($serverKey, $senderId);
$subscribe = new \Fcm\Topic\Subscribe('my_topic_name');
$subscribe->addDevice($deviceId);
$client->send($subscribe);

However, no success using the shortcut, what am I doing wrong:

$client = new \Fcm\FcmClient($serverKey, $senderId);
// Shortcut function:
$client->topicSubscribe('my_topic_name', $deviceId);
@EdwinHoksberg
Copy link
Owner

Hey, that should be working fine, which error do you get?

@rolinger
Copy link
Collaborator Author

No error actually. Just nothing happens.

$response = $client->topicSubscribe('topic',$devID) ;
print_r($response) ;

just returns the whole object and the topic does not get registered (used a new topic just to ensure it would show up in FCM console. Waited 10-15min...it never registered. Then used long form method and topic registered immediately.

@EdwinHoksberg
Copy link
Owner

EdwinHoksberg commented Jul 31, 2019

@rolinger, are you still experiencing this error? I don't think this is related to this package..

@rolinger
Copy link
Collaborator Author

@EdwinHoksberg - I still have the issue. Saying its an error is misleading as nothing actually happens - which is weird.

@Kulltero
Copy link

this issue is a year old, but i'd like to point out 2 things:

  1. when calling $client->topicSubscribe(), the second argument needs to be a string as the shorthand creates a Subscribtion instance that explicitly expects a string in its constructor (though this could be expanded to also allow arrays as the relevant function to add the deviceID does accept strings OR arrays).
  2. calling $client->topicSubscribe(); only creates the subscription object, it doesnt actually get submitted unless you do $client->send($Subscription);

this wasnt clear to me at first either, as the documentation doesnt imply that topicSubscribe actually returns a needed instance.
@EdwinHoksberg perhaps this could be made more clear on the documentation, and perhaps the constructor for the shorthands can accept arrays where applicable

@AndyGaskell
Copy link
Collaborator

I'll try address this in...
Improve documentation #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants