Fog Creek Software
Discussion Board

javascript socket server?


Ive been coding a kind of realtime chat thing using browser javascript, so as you type other browsers see it straight away.

Ive realised its not really possible to do it effectively:

- IE browsers always make a click sound when sending a request (why? - this so socks) and does anyone know of a workaround? (I was thinking of an activex component, the document.reload is not useful)

- browsers have unsuitable protocols for uploading and downloading continuous streams of data.

The method I found to update data on the browser is a continuous download of <javascript> tags which call a function to update content. This loops before server timeout. (beutiful!)

However I cannot do this for upload, when uploading changed data, e.g writing a realtime chat message, the browser post is flaky, sometimes going, sometimes getting stuck. And also freezing for a second as it clicks!

Does anyone know a nice workaround, id prefer to do this all browser side and not use plugins like java or flash as a workaround.

Im intending to make a ground breaking world dominating web app :) - you may be able to help!

thanks dudes...

aku beg
Thursday, June 17, 2004

On IE (5 and above IIRC) and above you can use the XMLHttpRequest object from JavaScript.  It doesn't have to be just XML that you're sending and receiving - it works well for any plain text.  Mozilla has a similar object but it's not quite as mature.

Thursday, June 17, 2004

Try it with Flash.

Green Pajamas
Thursday, June 17, 2004

I have had good results using this cross platform method of getting xml from a remote server from Javascript:

Matthew Lock
Thursday, June 17, 2004

There is also an extension to IE called the Web Services Behavior that will let you call web services from JavaScript.

Check out:

Of course, using something like a Java plugin will make your new killer-app browser independent, which is a nice feature.

Thursday, June 17, 2004

*  Recent Topics

*  Fog Creek Home