Particle-api-js EventStream lost after a few minutes

I’ve ported our code from spark.js to particle-api-js.

After Opening the EventStream (‘mine’, or all events) the eventstream stops working after a few seconds up to a few minutes. No ‘error’ or ‘end’ Event is issued for this.

Using the old Spark.JSLibary this problem occurs after a few days or so :frowning:

server.getEventStream({deviceId: 'mine', auth: token}).then(function(stream) {
    eventStream = stream;
    stream.on('event', function(data) {
        //logger.info({ev: data},'EVENT');
        mainEvent(data);
    });
    stream.on('error',function (err) {
        logger.error({e: err}, 'Stream has processsed error')
        if (!goingdown) {
            //ReOpen Stream, the Server is not Going Down!
            logger.info("Stream will re-opening in 5 seconds...");
            setTimeout(loginToSpark, 5 * 1000);
        }
    });
    stream.on('end', function () {
        logger.warn('EventStream was Closed, or forced to close!');
        if (!goingdown) {
            //ReOpen Stream, the Server is not Going Down!
            logger.info("Stream will re-opening in 5 seconds...");
            setTimeout(loginToSpark, 5 * 1000);
        }
    });
    if (started !== undefined) started();
});

Maybe the old Libary can solve this problem ?

I seem to be having the same issue.