MrProper
MrProper

Reputation: 1580

Websockets only webapplication?

I was recently introduced to websockets and I was thinking whether or not it could be possible or good idea to create webapplication only by using websockets.

Upvotes: 1

Views: 113

Answers (2)

Peter Moskovits
Peter Moskovits

Reputation: 4376

A model that works pretty well is that you use HTTP to get the static content (HTML, JavaScript, CSS, possibly images) of your web app to the browser and leverage websockets for everything that's dynamic. The beauty of this is that you can take advantage of caching for all the static resources.

With other words, you can completely eliminate the dynamically generated markup on the server-side (a'la JSP, PHP, and alike).

Upvotes: 1

jAndy
jAndy

Reputation: 236142

Yes, of course you can do that.

Your only caveat is that your webapplication is the limited to browser which support the websockets protocol. That is why lots of folks chooses a server/client library like socket.io to have fallbacks to other communication-layers, like XHR.

Upvotes: 0

Related Questions