Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / November 2007

Tip: Looking for answers? Try searching our database.

Have WCF Callback notify a single client ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
aiKeith - 26 Nov 2007 21:54 GMT
Hello,

Was wondering how or if this is possible - assuming the use of FullDuplex,
but open to whatever works well.

Goal:
Have x number of clients subscribe to a WCF fullduplex over tcp service --
lets say they subscribe to:  

DoIhaveMail()

On the server side, lets say we have an object that is alerted when a sql
table gets a new row, this object then invokes the IHaveMailOccured Event --

If this new row added to the table was mail for user b, how do i callback
only user b to say 'you have mail.' ?

I have read about Publish/Subscribe using Callbacks, streams and MSMQ -- but
its as tho the server alerts all clients who subscribed to that channel.

Thanks in advance :-)
Dominick Baier - 27 Nov 2007 08:27 GMT
Hi,

sure -

you either use the duplex support in WCF to store the CallbackChannels internally
and call back through them whenever an event occurs.

Or have your own infrastructure where the client news up a ServiceHost and
you pass a callback URI to the service for later notification.

-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

> Hello,
>
[quoted text clipped - 19 lines]
>
> Thanks in advance :-)
aiKeith - 27 Nov 2007 18:11 GMT
Hello Dominick, thank you so much for your response.

Questions tho:

" you either use the duplex support in WCF to store the CallbackChannels
internally  and call back through them whenever an event occurs."

If we have a callback that users subscribe to, how do we alert only a
particular client named 'flappy' that has subscribed to the callback?

"Or have your own infrastructure where the client news up a ServiceHost and
you pass a callback URI to the service for later notification."

Im still missing the part of how to raise the event for only a specific user
- or am i thinking too hard? ie:

For instance if 3 users subscribed to the event SomethingHappened();
How can i say raise the event SomethingHappened() only for user number 2?

For some reason im having a hard time grasping how this would actually work.

Thanks again for your comments, i hope to hear more :-)

> Hi,
>
[quoted text clipped - 34 lines]
> >
> > Thanks in advance :-)
Dominick Baier - 27 Nov 2007 19:30 GMT
how about storing the callback reference in a dictionary<string, channel>
that maps the user to a callback channel?

-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

> Hello Dominick, thank you so much for your response.
>
[quoted text clipped - 62 lines]
>>>
>>> Thanks in advance :-)
aiKeith - 27 Nov 2007 20:25 GMT
OK, this may be the part i was missing.  So each CallBackChannel is specific
to only one user?

:-)

> how about storing the callback reference in a dictionary<string, channel>
> that maps the user to a callback channel?
[quoted text clipped - 70 lines]
> >>>
> >>> Thanks in advance :-)
Dominick Baier - 27 Nov 2007 20:41 GMT
yep ;)
-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

> OK, this may be the part i was missing.  So each CallBackChannel is
> specific to only one user?
[quoted text clipped - 75 lines]
>>>>>
>>>>> Thanks in advance :-)
aiKeith - 27 Nov 2007 22:56 GMT
Thanks for sticking with me.  It all makes sense now, especially after
creating a complete working version - the piece i was completely missing was:

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession,
ConcurrencyMode:=ConcurrencyMode.Multiple)> _

The PerSession makes sense, i was assuming it was always a singleton, thus
all clients were using the same 'instance' of the object - obv. not so with
PerSession.

Thanks again for your help.  Have a great one !!!

> yep ;)
> -----
[quoted text clipped - 81 lines]
> >>>>>
> >>>>> Thanks in advance :-)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.