Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:52:30+00:00 2026-06-09T11:52:30+00:00

I’m developing an Asp.Net chat by using Ajax-Wcf Service enabled. It’s a very simple

  • 0

I’m developing an Asp.Net chat by using Ajax-Wcf Service enabled. It’s a very simple chat engine, where messages dialog means one to one (single user), however I don’t know how to manage (in a best way) notify for new message availability.
For instance, supposing the following scenario:

All time I need to send a new message from a user to another I write javascript code like this:

// btnSend client event handler
MyWcfNamespace.MyWcfClass instance = new ..();
instance.CallMethod("message string", callBackFunction, null);

Well, that’s very simple. Now, from the other side (user which will receive my message), needs for some mechanism in order to know when a new message has been sent. I thought to use an ajax timer to call another wcf Method which return me string message if it is available, or empty string if isn’t,
but I think ther’s a best way to accmplish this.

It would be great if exist some way to register for some wcf event by javascript:

// javascript code:
MyWcfNamespace.MyWcfClass instance = new ..();
instance.OnNewMessageAvailable = myJavascriptCallBackFunction;
// And on CallBack function..
function myJavaScriptCallbackFunction(msg) {
alert('new message arraived:' + msg):
}

Obviously, my wcf service should be implement some static event to manage all notify I needs.

Any suggestions will be appreciated.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:52:31+00:00Added an answer on June 9, 2026 at 11:52 am

    With WCF you could do it by using techniques like long polling, to achieve this but obviously this would not be very easy. Look at this example on how to

    There are many JS libararies which make this work eassy for you. SignalR is one of them
    Look at this Wiki on how to

    Update 2

    If you are using Wcf 4.5, another way to accomplish this task would be using web sockets. Chat Application requires push based technology rather than pull based technology. Wcf 4.5 give you this power by supporting Web Sockets. Example

    Update 3

    If you have decided to use Long Polling, then you do not have use async methods. The long polling will work as following.

    1. Send the request to the server.
    2. Wait till response comes, or time out
    3. Go to client, make another request.

    So instead of using async result(since the call to web service from JS would already be async), you would use normal method with Thread Signalling techniques like WaitOne(for waiting till new request comes) and ManualResetEvent for signalling, some request has come.

    Notice, Long polling is far better than polling as response is always up to date.

    Look at this implementation of Chat Server using Wcf and Long Polling

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.