-
Notifications
You must be signed in to change notification settings - Fork 167
Streaming stops without emitting an error #168
Comments
I have the same issue... |
I also have the same issue. I used the forked 'https://github.com/crimson-education/nforce' instead using this. and my implementation also looks like this. no messages are received after some time but the connection is still there. so curious. |
Ok, I’m going to look into it this week.
On Mon, Jan 21, 2019 at 6:29 AM ***@***.*** ***@***.***> wrote:
I also have the same issue. I used the forked '
https://github.com/crimson-education/nforce' instead using this. and my
implementation also looks like this. no messages are received after some
time but the connection is still there. so curious.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#168 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAigQLcX7m1Mj8G0XoMogj3VLjQGYGGvks5vFaSfgaJpZM4aKQB0>
.
--
*Kevin O'Hara* | tw:kevohara <https://twitter.com/kevohara> | github:
kevinohara80 <https://github.com/kevinohara80>
|
For anyone who comes up with the same issue I had, here's how I handled this. First, I forked this repo and changed the
Now Faye client will emit a Then publish this as a separate npm module or use the git path itself in Now in your code, you can simply check whether streaming client emits a Here's my sample code:
Note this line Hope this helps until Kevin updates |
I have this running in the 2.0 branch but I’m not getting any disconnect
events. Any ideas? It’s such a pain to test because you have to wait around
for Salesforce to kill the connection.
On Tue, Jan 29, 2019 at 7:43 AM Eranga Heshan ***@***.***> wrote:
For anyone who comes up with the same issue I had, here's how I handled
this.
First, I forked this repo and changed the lib/fdcstream.js file and add
following lines to the end of Client function (client definition).
var reconnectExtension = {
incoming: function(message, callback) {
if (message.channel === '/meta/disconnect') {
self.emit('reconnect');
}
callback(message);
}
};
this._fayeClient.addExtension(reconnectExtension);
Now Faye client will emit a reconnect event whenever it gets
/meta/disconnect.
Then publish this as a separate npm module or use the git path itself in
package.json when using nforce module.
Now in your code, you can simply check whether streaming client emits a
reconnect event and do necessary handling.
Here's my sample code:
const connection = nforce.createConnection({
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
redirectUri: CALLBACK_URL + '/oauth/_callback',
mode: 'single',
environment: ENVIRONMENT,
apiVersion: 'v41.0',
autoRefresh: true,
username: USERNAME,
password: PASSWORD
});
connection.authenticate();
const client = connection.createStreamClient();
const stream = client.subscribe({
topic: TOPIC,
replayId: REPLAY_ID
});
client.on('reconnect', this.onReconnectHandler);
stream.on('connect', this.onConnectHandler);
stream.on('error', this.onErrorHandler);
stream.on('data', this.onDataHandler);
Note this line client.on('reconnect', this.onReconnectHandler); where I
try to reconnect back to topic.
Hope this helps until Kevin updates nforce.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#168 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAigQLHtDCtFvFS-Cuz1GlhkfD_ZN2ugks5vIEIIgaJpZM4aKQB0>
.
--
*Kevin O'Hara* | tw:kevohara <https://twitter.com/kevohara> | github:
kevinohara80 <https://github.com/kevinohara80>
|
I am using the current version of nforce library with the modifications of
replayId
from crimson-education. The client works for some time and stops getting new events from Salesforce without emitting any errors. Below here is how I have implemented the streaming client.Could you help find what I did wrong?
Above is the minimalistic code that explains my order of execution.
CC: @kevinohara80
The text was updated successfully, but these errors were encountered: