Bots Home
|
My Uploads
|
Create an App
abgshah
Author:
abgshah
Description
Source Code
Launch Bot
Current Users
Created by:
Abgshah
App Images
let feedUrl = 'https://eventsapi.chaturbate.com/events/{username}/{token}/'; let stopPolling = false; function poll(url, count = 0){ //If count is 0 it can be used to identify if the long polling just started $.ajax({ url: url, success: function(result){ try{ //The events can be found in this array which happened since the last request(empty if nothing happened in that interval) const events = result.events; //check if url exists in the response(might be unnecessary) & check if the polling is stopped or not if(!result.nextUrl || stopPolling) return; const nextUrl = new URL(result.nextUrl); nextUrl.searchParams.set("timeout", 0); poll(nextUrl.href, count + 1); }catch(e){ //handle errors stop(); } }, error: function(a, b, c){ //handle errors stop(); } }); } function start(url){ stopPolling = false; poll(url); } function stop(){ stopPolling = true; }
© Copyright Chaturbate 2011- 2026. All Rights Reserved.