Forum Moderators: open

Message Too Old, No Replies

Monitor a port with JavaScript?

Is there a way to listen to a port for server event via JavaScript?

         

JAB Creations

7:23 pm on Nov 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of making requests every x number of milliseconds is there a way to have JavaScript simply listen to a port for communications from the server?

- John

whoisgregg

10:50 pm on Nov 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not normally. Servers don't "push" their data to clients, clients "pull" the data from the server. However, you may want to look into "Comet" which allows the server to push data to the client. (If I recall correctly, it's by keeping open the connection indefinitely... but I haven't really looked into it.)

Web searches for "comet javascript" and similar should get you enough information to determine if it's right for your needs. :)