I saw an implementation exampleforever iframe (cometary modeling), so I decided to test it, but with the addition of asynchronous , so that there would be no lock.
Pretty simple:
I have a page ( index.html) with a hidden iframeone that has an SRC AdminPush.aspx:
protected void Page_Load(object sender, EventArgs e)
{
UpdateMessage();
}
protected void UpdateMessage()
{
HttpContext.Current.Response.ContentType = "text/html";
Response.Write("<script >parent.UpdateMessage(DateTime.Now.Second)</script>");
Response.Flush();
this.RegisterAsyncTask(new PageAsyncTask(async cancellationToken =>
{
await Task.Delay(2000, cancellationToken);
UpdateMessage();
}));
}
On the page, AdminPush.aspxI added:
Async="true"
On the html ( index.html) page, I added:
function UpdateMessage(Message)
{
console.log(Message);
}
function setupAjax() //body Onload - calls it.
{
var iframe = document.createElement("iframe");
iframe.src = "adminpush.aspx";
iframe.style.display = "none";
document.body.appendChild(iframe);
}
So basically iframe introduces script comands, which updates the parent iframe element which is index.html.
He works.
But when I tested it, it stopped updating after 45 seconds.
I thought this was due to requestTimeout prop in web.config - but it is not.
AsyncTimeOut AdminPush.aspx.
№1:
msdn AsyncTimeout:
, , , .
:
TimeSpan, . 45 .
, "" 2
- 1 , . , , sum(all async operations)
? , - ! (), sum(tasks)
. ?
№ 2:
. ? , , . , .
, RESET ( n )?
, /, signalR, , , , .