Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Comet implementation

Reply
Thread Tools

Comet implementation

 
 
Jonny Bergdahl
Guest
Posts: n/a
 
      01-20-2009
> So far based on my research, at server-side, WCF method can use
> "OperationContext.Current" to inspect some WCF method invocation context
> info. And the OperationContext class has a "InstanceContext" property that
> can help inspect the current communication object's State:


Sorry for the late reply, I haven't come around to this until now.

I am sorry to report that this does not seem work. The
OperationContext.Current.InstanceContext.State only seems to track the
internal state of thre service object, and not the communication state.

When I have initiated a connection from the client, State is set top Opened.
But even after I have closed down the Client, it is still set to Opened even
though the HTTP connection is closed.

What I need is to keep track of the underlying HTTP connection state,
something like HttpResponse.IsClientConnected.

Any other ideas on how to get to the underlying connection?

Regards;
/jb

 
Reply With Quote
 
 
 
 
Steven Cheng
Guest
Posts: n/a
 
      01-21-2009
Hi Jonny,

Thanks for your followup.

Also sorry for the late reponse as I was dealing with some other issues
recently. Regarding on the detecting client-side disconnecting problem,
I've also performed some further research. It seems for normal one-way
binding(comparing to thte duplex binding), the client-side disconnect
detection is not real-time. Here are some web articles discussing on this
issue:

#WCF Notification on Disconnect
http://www.rcs-solutions.com/blog/20...Disconnect.asp
x

#Taking Action on Client Close
http://blogs.msdn.com/drnick/archive...on-client-clos
e.aspx

#Provide Way to Detect Client Abort/Disconnect in WCF
http://social.msdn.microsoft.com/For...e30-fc74-4a52-
9dfd-232c67c84f7a

I've tried registering some eventhandler on the OperationContext's Channel,
but those event won't be raised until the service method return data to
client-side. e.g,

========================
public string GetData(string user)
{
Console.WriteLine("GetData Begin:{0}", DateTime.Now);


OperationContext oc = OperationContext.Current;


oc.Channel.Closed += new EventHandler(Channel_Closed);
oc.Channel.Closing += new EventHandler(Channel_Closing);
oc.Channel.Faulted += new EventHandler(Channel_Faulted);


for (int i = 0; i < 10; ++i)
{
Console.WriteLine("Loop:{0}, State:{1}",i,
oc.Channel.State);


Thread.Sleep(1000 * 3);
}


Console.WriteLine("GetData End:{0}", DateTime.Now);

return "result of " + user;

}
===============================

If duplex binding is possible for your scenario, you may have a try on the
solution mentioned in above articles.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.


--------------------
>From: "Jonny Bergdahl" <(E-Mail Removed)>
>Subject: Comet implementation
>Date: Tue, 20 Jan 2009 16:43:19 +0100


>
>> So far based on my research, at server-side, WCF method can use
>> "OperationContext.Current" to inspect some WCF method invocation context
>> info. And the OperationContext class has a "InstanceContext" property

that
>> can help inspect the current communication object's State:

>
>Sorry for the late reply, I haven't come around to this until now.
>
>I am sorry to report that this does not seem work. The
>OperationContext.Current.InstanceContext.State only seems to track the
>internal state of thre service object, and not the communication state.
>
>When I have initiated a connection from the client, State is set top

Opened.
>But even after I have closed down the Client, it is still set to Opened

even
>though the HTTP connection is closed.
>
>What I need is to keep track of the underlying HTTP connection state,
>something like HttpResponse.IsClientConnected.
>
>Any other ideas on how to get to the underlying connection?
>
>Regards;
>/jb
>
>


 
Reply With Quote
 
 
 
 
Jonny Bergdahl
Guest
Posts: n/a
 
      01-23-2009
Unfortunately, the web service is consumed over the internet, so there is no
way to initiate a callback to the client.

Regards;
/jb

""Steven Cheng"" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> Hi Jonny,
>
> Thanks for your followup.
>
> Also sorry for the late reponse as I was dealing with some other issues
> recently. Regarding on the detecting client-side disconnecting problem,
> I've also performed some further research. It seems for normal one-way
> binding(comparing to thte duplex binding), the client-side disconnect
> detection is not real-time. Here are some web articles discussing on this
> issue:
>
> #WCF Notification on Disconnect
> http://www.rcs-solutions.com/blog/20...Disconnect.asp
> x
>
> #Taking Action on Client Close
> http://blogs.msdn.com/drnick/archive...on-client-clos
> e.aspx
>
> #Provide Way to Detect Client Abort/Disconnect in WCF
> http://social.msdn.microsoft.com/For...e30-fc74-4a52-
> 9dfd-232c67c84f7a
>
> I've tried registering some eventhandler on the OperationContext's
> Channel,
> but those event won't be raised until the service method return data to
> client-side. e.g,
>
> ========================
> public string GetData(string user)
> {
> Console.WriteLine("GetData Begin:{0}", DateTime.Now);
>
>
> OperationContext oc = OperationContext.Current;
>
>
> oc.Channel.Closed += new EventHandler(Channel_Closed);
> oc.Channel.Closing += new EventHandler(Channel_Closing);
> oc.Channel.Faulted += new EventHandler(Channel_Faulted);
>
>
> for (int i = 0; i < 10; ++i)
> {
> Console.WriteLine("Loop:{0}, State:{1}",i,
> oc.Channel.State);
>
>
> Thread.Sleep(1000 * 3);
> }
>
>
> Console.WriteLine("GetData End:{0}", DateTime.Now);
>
> return "result of " + user;
>
> }
> ===============================
>
> If duplex binding is possible for your scenario, you may have a try on the
> solution mentioned in above articles.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> (E-Mail Removed).
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#notifications.
>
>
> --------------------
>>From: "Jonny Bergdahl" <(E-Mail Removed)>
>>Subject: Comet implementation
>>Date: Tue, 20 Jan 2009 16:43:19 +0100

>
>>
>>> So far based on my research, at server-side, WCF method can use
>>> "OperationContext.Current" to inspect some WCF method invocation context
>>> info. And the OperationContext class has a "InstanceContext" property

> that
>>> can help inspect the current communication object's State:

>>
>>Sorry for the late reply, I haven't come around to this until now.
>>
>>I am sorry to report that this does not seem work. The
>>OperationContext.Current.InstanceContext.State only seems to track the
>>internal state of thre service object, and not the communication state.
>>
>>When I have initiated a connection from the client, State is set top

> Opened.
>>But even after I have closed down the Client, it is still set to Opened

> even
>>though the HTTP connection is closed.
>>
>>What I need is to keep track of the underlying HTTP connection state,
>>something like HttpResponse.IsClientConnected.
>>
>>Any other ideas on how to get to the underlying connection?
>>
>>Regards;
>>/jb
>>
>>

>


 
Reply With Quote
 
msdngroup
Guest
Posts: n/a
 
      01-29-2009
See this site:

HTTP server push

http://www.udaparts.com/document/Tutorial/httppush.htm



"Jonny Bergdahl" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>> So far based on my research, at server-side, WCF method can use
>> "OperationContext.Current" to inspect some WCF method invocation context
>> info. And the OperationContext class has a "InstanceContext" property
>> that
>> can help inspect the current communication object's State:

>
> Sorry for the late reply, I haven't come around to this until now.
>
> I am sorry to report that this does not seem work. The
> OperationContext.Current.InstanceContext.State only seems to track the
> internal state of thre service object, and not the communication state.
>
> When I have initiated a connection from the client, State is set top
> Opened.
> But even after I have closed down the Client, it is still set to Opened
> even
> though the HTTP connection is closed.
>
> What I need is to keep track of the underlying HTTP connection state,
> something like HttpResponse.IsClientConnected.
>
> Any other ideas on how to get to the underlying connection?
>
> Regards;
> /jb
>



 
Reply With Quote
 
Steven Cheng
Guest
Posts: n/a
 
      02-02-2009
I've performed some further research. Seems normal request/response channel
cannot provide real-time detection on client-side disconnect. If you need
to have a reliable way for detecting, client-side must also expose an
endpoint that can be queried by the server-side.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Jonny Bergdahl" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
>In-Reply-To: <(E-Mail Removed)>
>Subject: Re: Comet implementation
>Date: Fri, 23 Jan 2009 15:53:03 +0100


>
>Unfortunately, the web service is consumed over the internet, so there is

no
>way to initiate a callback to the client.
>
>Regards;
>/jb
>
>""Steven Cheng"" <(E-Mail Removed)> skrev i meddelandet
>news:(E-Mail Removed)...
>> Hi Jonny,
>>
>> Thanks for your followup.
>>
>> Also sorry for the late reponse as I was dealing with some other issues
>> recently. Regarding on the detecting client-side disconnecting problem,
>> I've also performed some further research. It seems for normal one-way
>> binding(comparing to thte duplex binding), the client-side disconnect
>> detection is not real-time. Here are some web articles discussing on this
>> issue:
>>
>> #WCF Notification on Disconnect
>>

http://www.rcs-solutions.com/blog/20...Disconnect.asp
>> x
>>
>> #Taking Action on Client Close
>>

http://blogs.msdn.com/drnick/archive...on-client-clos
>> e.aspx
>>
>> #Provide Way to Detect Client Abort/Disconnect in WCF
>>

http://social.msdn.microsoft.com/For...e30-fc74-4a52-
>> 9dfd-232c67c84f7a
>>
>> I've tried registering some eventhandler on the OperationContext's
>> Channel,
>> but those event won't be raised until the service method return data to
>> client-side. e.g,
>>
>> ========================
>> public string GetData(string user)
>> {
>> Console.WriteLine("GetData Begin:{0}", DateTime.Now);
>>
>>
>> OperationContext oc = OperationContext.Current;
>>
>>
>> oc.Channel.Closed += new EventHandler(Channel_Closed);
>> oc.Channel.Closing += new EventHandler(Channel_Closing);
>> oc.Channel.Faulted += new EventHandler(Channel_Faulted);
>>
>>
>> for (int i = 0; i < 10; ++i)
>> {
>> Console.WriteLine("Loop:{0}, State:{1}",i,
>> oc.Channel.State);
>>
>>
>> Thread.Sleep(1000 * 3);
>> }
>>
>>
>> Console.WriteLine("GetData End:{0}", DateTime.Now);
>>
>> return "result of " + user;
>>
>> }
>> ===============================
>>
>> If duplex binding is possible for your scenario, you may have a try on

the
>> solution mentioned in above articles.
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>> Delighting our customers is our #1 priority. We welcome your comments and
>> suggestions about how we can improve the support we provide to you.

Please
>> feel free to let my manager know what you think of the level of service
>> provided. You can send feedback directly to my manager at:
>> (E-Mail Removed).
>>
>> ==================================================
>> Get notification to my posts through email? Please refer to
>>

http://msdn.microsoft.com/en-us/subs...#notifications.
>>
>>
>> --------------------
>>>From: "Jonny Bergdahl" <(E-Mail Removed)>
>>>Subject: Comet implementation
>>>Date: Tue, 20 Jan 2009 16:43:19 +0100

>>
>>>
>>>> So far based on my research, at server-side, WCF method can use
>>>> "OperationContext.Current" to inspect some WCF method invocation

context
>>>> info. And the OperationContext class has a "InstanceContext" property

>> that
>>>> can help inspect the current communication object's State:
>>>
>>>Sorry for the late reply, I haven't come around to this until now.
>>>
>>>I am sorry to report that this does not seem work. The
>>>OperationContext.Current.InstanceContext.Stat e only seems to track the
>>>internal state of thre service object, and not the communication state.
>>>
>>>When I have initiated a connection from the client, State is set top

>> Opened.
>>>But even after I have closed down the Client, it is still set to Opened

>> even
>>>though the HTTP connection is closed.
>>>
>>>What I need is to keep track of the underlying HTTP connection state,
>>>something like HttpResponse.IsClientConnected.
>>>
>>>Any other ideas on how to get to the underlying connection?
>>>
>>>Regards;
>>>/jb
>>>
>>>

>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comet implementation in WCF Jonny Bergdahl ASP .Net Web Services 8 01-21-2009 09:16 AM
Night of the Comet Joceanne DVD Video 1 08-01-2005 02:35 AM
What happened to Night of the Comet? Gamilia DVD Video 4 01-19-2004 12:13 AM
Night of the Comet ominousspiritous DVD Video 6 10-27-2003 11:15 PM
Night of the Comet? any word? Sam Lowry DVD Video 8 10-03-2003 08:34 AM



Advertisments