Websocket frame size limitation

A single WebSocket frame, per RFC-6455 base framing, has a maximum size limit of 2^63 bytes (9,223,372,036,854,775,807 bytes ~= 9.22 exabytes) (correction by @Sebastian) However, a WebSocket message, made up of 1 or more frames, has no limit imposed on it from the protocol level. Each WebSocket implementation will handle message and frame limits differently. … Read more

File API – Blob to JSON

You should have tried readAsText() instead of readAsArrayBuffer() (JSON is text in the end). You’ve also missed to stringify the object (convert to JSON text) var b = new Blob([JSON.stringify({“test”: “toast”})], {type : “application/json”}), fr = new FileReader(); fr.onload = function() { console.log(JSON.parse(this.result)) }; fr.readAsText(b);

Proxying WebSockets with TCP load balancer without sticky sessions

I think what we need to understand in order to answer this question is how exactly the underlying TCP connection evolves during the whole WebSocket creation process. You will realize that the sticky part of a WebSocket connection is the underlying TCP connection itself. I am not sure what you mean with “session” in the … Read more

How to debug Websockets?

Wireshark sounds like what you want actually. There is very little framing or structure to WebSockets after the handshake (so you want low-level) and even if there was, wireshark would soon (or already) have the ability to parse it and show you the structure. Personally, I often capture with tcpdump and then parse the data … Read more

At what point are WebSockets less efficient than Polling?

The whole point of a websocket connection is that you don’t ever have to ping the app for changes. Instead, the client just connects once and then the server can just directly send the client changes whenever they are available. The client never has to ask. The server just sends data when it’s available. For … Read more

Why to use websocket and what is the advantage of using it?

Why use websocket over http? A webSocket is a continuous connection between client and server. That continuous connection allows the following: Data can be sent from server to client at any time, without the client even requesting it. This is often called server-push and is very valuable for applications where the client needs to know … Read more

Sharing websocket across browser tabs?

After seeing this question, I’ve finally implemented sharing socket and added to my library a few days ago. It seems to work in most of browsers including even in IE6, but except Opera. For Opera, you may use regular checking instead of unload event. Check releated issue at https://github.com/flowersinthesand/portal/issues/21 ###Leaving a cookie Set cookie to … Read more

Express and WebSocket listening on the same port

Based on your code and comments, here’s a super simple example of how it would work together. First, the http-server.js – a typical express app, except that we do not start the server with app.listen(): ‘use strict’; let fs = require(‘fs’); let express = require(‘express’); let app = express(); let bodyParser = require(‘body-parser’); app.use(bodyParser.json()); // … Read more