473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

best/most efficient way of notifying clients about changes

Hi folks,

I'm writing a webapplication in which some actions need to be propagated to all the other clients currently logged in. Notification should happen almost realtime ( ~ 1 sec) and i'm wondering about the best way to accomplish this.

Afaik there are a couple of options:
- polling (personally i hate this option, because it seems very inefficient)
- opening a connection, keep it open en read data from responseText each time the state changes. Basically we don't close the connection. I guess this is more efficient than polling, but has as disadvantage we need to abort the connection when i need to send another request to the server. In my case this happens quite often (opening of dialogs) so i keep aborting and requesting.

It would be ideal if it was possible to open more than one connection simultaneously to the server. One would remain open and serves only as a notificationchannel while i could still send other reqeusts to the server at the same time.

I always thought this was possible, but after testing i found out i could only have one open connection at a time. Maybe this is a restriction on the server and/or client? Or maybe it's simply me, doing something wrong.
Anyway, i'd love to have some insights on the matter, for maybe there are better ways to accomplish notification.

Thanks in advance,
Jul 15 '07 #1
7 1603
wow, is there really no-one with some insight in this matter? I can't believe i'm the first person dealing with this :^)

Any ideas where else i might try asking this question?

thnx!
Jul 19 '07 #2
acoder
16,027 Expert Mod 8TB
I'm not sure about the best or the most efficient, but based on what you have said, you could have two Ajax requests at the same time using two different objects. Is that what you have tried?
Jul 19 '07 #3
yep, that was my first idea as well, but somehow, the second request wouldn't be send till the first one was finished.
I i could manage to have 2 simultaneous connections everything would be solved.

Maybe i should provide some examplecode to illustrate the problem?

Thanks for replying btw :^)
Jul 19 '07 #4
acoder
16,027 Expert Mod 8TB
Maybe i should provide some examplecode to illustrate the problem?
Yes, please, or a link.
Jul 20 '07 #5
i'll try to get you a minimal example of the problem. I also have to do some other things in the meanwhile, so i can take a couple of hours before i have anything.
Jul 20 '07 #6
after creating a small testcase i couldn't reproduce the problem. I am able to send 2 (but not more) requests simultaneously. However, in my real project this doesn't work. I suspect it has something to do the the prototype library which has screwed things before.

I'll do some more digging and will get back with the results.
Jul 20 '07 #7
it's indeed related to prototype.js, because it extends basic javascriptobjects some default behaviour doesn't work as expected anymore.

See http://blog.metawrap.com/blog/WhyIDontUseThePrototypejsJavaScriptLibrary.aspx for more information on this.

I only use prototype.js, because i need it as a dependency for the ricoLiveGrid, but i think i'll try to find an alternative to that. Or write one myself.

Thanks for your replies, even though this ultimately appeared to be a non-issue :)
Jul 20 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
2
by: MLH | last post by:
We have a table (tblClients) with several thousand records. Because of organizational structure, changes to those records are maintained in a separate database. Weekly, about a dozen or so clients...
10
by: Brett | last post by:
If I have many hard coded values such as file paths, file names, timeouts, etc, where is the best place to define them? Meaning, in the case something needs changing for example, rather than...
0
by: marc.derider | last post by:
I was making a change to a Web service. It was something extremely trivial, such as adding a single parameter to extend the functionality exposed through that method. It got me to thinking...
3
by: Marc Gravell | last post by:
Kind of an open question on best-practice for smart-client design. I'd really appreciate anyones views (preferably with reasoning, but I'll take what I get...). Or if anybody has any useful links...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
51
by: bigHairy | last post by:
Hello. I have been teaching myself .NET over the last few months and have had some success. I would like to ask a question though... A number of examples I have followed have the following in...
14
by: Patrick A | last post by:
All, I have an Access DB. On a nightly basis, I want to look at an Other DB (not Access, but SQL) and: + Add any new records from Other.Clients into Access.Clients Is this something I...
2
by: Ben Joyce | last post by:
Hi all. I'm confused as to what the best or expected approch is to Web Service design under .Net, mainly with regards to Methods and Parameters. This is a bit awkward to explain so please bear...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.