{"size": 393, "ext": "js", "max_stars_repo_path": "src/quote.tracker.js", "max_stars_repo_name": "martinpinto/stock-notifier", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/quote.tracker.js", "max_issues_repo_name": "martinpinto/stock-notifier", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/quote.tracker.js", "max_forks_repo_name": "martinpinto/stock-notifier", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.5625, "max_line_length": 49, "alphanum_fraction": 0.5877862595}
const getQuote = require('./quote.service');
const FETCH_INTERVAL = 5000;

export const trackTicker = (socket, ticker) => {
    // run the first time immediately
    getQuote(ticker);

    // every N seconds
    var timer = setInterval(() => {
        getQuote(socket, ticker);
    }, FETCH_INTERVAL);

    socket.on('disconnect', () => {
        clearInterval(timer);
    });
}