James T
James T

Reputation: 3320

Live Connection from Javascript/html

Is there a way to have a live connection (like for a chat server) with a server using only HTML(5)/JavaScript?

Upvotes: 0

Views: 566

Answers (3)

Stefan Kendall
Stefan Kendall

Reputation: 67812

Apparently FF4, Chrome, and Safari all support Web Sockets.

Here's a firefox example, although I'm not sure the spec is completely finalized yet.

Upvotes: 1

NullUserException
NullUserException

Reputation: 85458

Due to the nature of HTTP (only clients can start requests), you would need a "Push" server (aka Comet) on the server-side. You'd still only need JS on the client. See:

This can also be implemented with a periodic refresh (polling) if you can't install a Comet engine on the server.

Upvotes: 1

Stefan Kendall
Stefan Kendall

Reputation: 67812

Yup. AJAX and some server code to handle messages updates is all you need to create just such a system. As @NullUserException noted, something like Comet might make this easier.

Upvotes: 0

Related Questions