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

Queries on _handleAdvice function #535

Open
dtto86 opened this issue Mar 31, 2022 · 1 comment
Open

Queries on _handleAdvice function #535

dtto86 opened this issue Mar 31, 2022 · 1 comment

Comments

@dtto86
Copy link

dtto86 commented Mar 31, 2022

Hi

On reception of {"advice":{"interval":0,"reconnect":"handshake"},"channel":"/meta/connect","id":"5p","error":"403::Unknown client","successful":false} error from Salesforce.com, client calls _handleAdvice function https://github.com/faye/faye/blob/master/src/protocol/client.js#L353 and creates new client and new subscription on a topic with replayId.

My questions are

  1. Why faye client is calling connect function on occurrence of "advice":{"interval":0,"reconnect":"handshake"} in _handleAdvice? Is it as per the design?
  2. Why faye client is creating new subscription with older replayId. Please note here, we are using nforce npm package.
    Last processed event:
    {"data":{"schema":"0c5uHJiCMwqzxeBHzibiag","payload":{"CreatedById":"0055g000004VXJnAAO","CreatedDate":"2022-03-24T15:34:18.123Z","abc__c":"amrt-run"},"event":{"replayId":4817372}},"channel":"/event/PlatformEvent__e"}
    Subscription after 403::Unknown client error:
    {"channel":"/meta/subscribe","clientId":"6qnbw6zn8dabkws28tn7mawylg9","subscription":"/event/PlatformEvent__e","id":"2x","ext":{"replay":{"/event/MyPSL__e":4817264}}}
  3. Can we override the _handleAdvice so that underlying faye client should not call it's in-built _handleAdvice but override function called in our code?
@jcoglan
Copy link
Collaborator

jcoglan commented Mar 31, 2022

The intended behaviour of the Faye client when receiving a "reconnect": "handshake" message like this is that it should forget its current clientId, and perform a fresh handshake to get a new clientId from the server. Once it has done that successfully, it re-registers any subscriptions to channels it was subscribed to before its previous session expired, so that you don't have to handle this reconnection failure yourself.

I am not able to answer questions about the Salesforce API. Overriding _handleAdvice() is not recommended as it is a private method, and changing its behaviour will probably break the client in some way.

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

2 participants