Why use AJAX when WebSockets is available?

WebSockets isn’t intended to replace AJAX and is not strictly even a replacement for Comet/long-poll (although there are many cases where this makes sense). The purpose of WebSockets is to provide a low-latency, bi-directional, full-duplex and long-running connection between a browser and server. WebSockets opens up new application domains to browser applications that were not … Read more

Send message to specific client with socket.io and node.js

Ivo Wetzel’s answer doesn’t seem to be valid in Socket.io 0.9 anymore. In short you must now save the socket.id and use io.sockets.socket(savedSocketId).emit(…) to send messages to it. This is how I got this working in clustered Node.js server: First you need to set Redis store as the store so that messages can go cross … Read more

Difference between socket and websocket?

To answer your questions. Even though they achieve (in general) similar things, yes, they are really different. WebSockets typically run from browsers connecting to Application Server over a protocol similar to HTTP that runs over TCP/IP. So they are primarily for Web Applications that require a permanent connection to its server. On the other hand, … Read more

What browsers support HTML5 WebSocket API?

Client side Hixie-75: Chrome 4.0 + 5.0 Safari 5.0.0 HyBi-00/Hixie-76: Chrome 6.0 – 13.0 Safari 5.0.2 + 5.1 iOS 4.2 + iOS 5 Firefox 4.0 – support for WebSockets disabled. To enable it see here. Opera 11 – with support disabled. To enable it see here. HyBi-07+: Chrome 14.0 Firefox 6.0 – prefixed: MozWebSocket IE … Read more

WebRTC vs Websockets: If WebRTC can do Video, Audio, and Data, why do I need Websockets? [closed]

WebRTC is designed for high-performance, high quality communication of video, audio and arbitrary data. In other words, for apps exactly like what you describe. WebRTC apps need a service via which they can exchange network and media metadata, a process known as signaling. However, once signaling has taken place, video/audio/data is streamed directly between clients, … Read more

In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?

WebSockets is definitely the future now. Long polling is a dirty workaround to prevent creating connections for each request like AJAX does – but long polling was created when WebSockets didn’t exist. Now due to WebSockets, long polling is going away no more. WebRTC allows for peer-to-peer communication. I recommend learning WebSockets. Comparison: of different … Read more

HTTP headers in Websockets client API

Updated 2x Short answer: No, only the path and protocol field can be specified. Longer answer: There is no method in the JavaScript WebSockets API for specifying additional headers for the client/browser to send. The HTTP path (“GET /xyz”) and protocol header (“Sec-WebSocket-Protocol”) can be specified in the WebSocket constructor. The Sec-WebSocket-Protocol header (which is … Read more

Does HTTP/2 make websockets obsolete?

After just getting finished reading RFC 7540, HTTP/2 does obsolete websockets for all use cases except for pushing binary data from the server to a JS webclient. HTTP/2 fully supports binary bidi streaming (read on), but browser JS doesn’t have an API for consuming binary data frames and AFAIK such an API is not planned. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)