SQLDependency等效于MySQL

我想在我的ASP.net项目上实现实时更新,所以我试图实现长轮询机制和Comet。

var isPolling = 0; function longPolling() { isPolling++; $.ajax({ type: "GET", url: "CometAsyncHandler.ashx?waitTime=60", // one minute //async: true, cache: false, //timeout:12000, success: function(data){ isPolling--; if(data == "NEWDATAISAVAILABLE") RefreshData(); // this function is generated by using RegisterFunctionToPostBack() else if( data == "TOOLONG-DOITAGAIN" ) setTimeout("longPolling()", 0 ); else addLongPollingError("error", "Error on server side. Received data: \"" + data + "\""); }, error: function(XMLHttpRequest, textStatus, errorThrown){ isPolling--; addLongPollingError("error", textStatus + " (" + errorThrown + ")"); } }); 

}

 $(document).ready(function(){ longPolling(); // Start the initial request }); 

我已成功使用SqlDependency类为MS SQL数据库完成了它,它可以工作,但如何使用MySQL DB。

你必须进行民意调查。 虽然理论上你可以利用二进制日志 ,但我不知道任何试图实现这一目标的项目。

请参阅示例MySqlDependency