Questions tagged [websocket]

WebSocket is an API built on top of TCP sockets and a protocol for bi-directional, full-duplex communication between client and server without the overhead of http.

WebSockets (or WebSocket) is an API and a protocol for bi-directional, full-duplex communication over TCP sockets. The WebSockets API was originally part of the HTML5 standard, but it has been split off into a separate W3C standard. The WebSockets protocol is an IETF standard described in RFC 6455.

The WebSockets API has full browser support in Chrome 14, Firefox 6, IE 10 (desktop and mobile), Opera 12.1 (desktop and mobile), Safari 6.0 (desktop and mobile), Android 4.4, Chrome Mobile, and Firefox Mobile. Some older browsers have partial support or can be supported using a Flash based fallback.

WebSockets supports both unencrypted and encrypted connections. Unencrypted connections use the "ws://" URL scheme and default to port 80. Encrypted connections use the "wss://" URL scheme and default to port 443. Encrypted connections use Transport Layer Security (TLS).

Simple WebSockets browser JavaScript example:

if ("WebSocket" in window) {
    var ws = new WebSocket("ws://echo.websocket.org/");
    ws.onopen = function() {
        console.log("WebSockets connection opened");
        ws.send("a test message");
    }
    ws.onmessage = function(e) {
        console.log("Got WebSockets message: " + e.data);
    }
    ws.onclose = function() {
        console.log("WebSockets connection closed");
    }
} else {
    // No native support
}

Useful Links

Books

197 questions
4
votes
1 answer

TeamCity, nginx, and Websockets - 501 Error

I'm currently setting up TeamCity behind an nginx reverse proxy, but I am getting an error in my browser. The error is as follows: WebSocket connection to…
mattrick
  • 143
  • 1
  • 1
  • 10
4
votes
1 answer

Application layer firewall for WebSockets?

My team has built an intranet portal in Amazon AWS for a client, and on it, we have used WebSockets to do things like notifications and other minor stuff. We mostly send events from the server, but we also use it so the client can quickly notify the…
Mike Caron
  • 237
  • 2
  • 13
4
votes
0 answers

Heroku and socket.io out of memory

I have a setup with websockets on heroku and every now and then i get a flurry of messages like this: 06:24.591694+00:00 heroku router - - at=error code=H15 desc="Idle connection" method=GET…
4
votes
0 answers

Is websocket reverse proxy possible with IIS 8.5 & URL rewrite 2.0?

I installed Tomcat as a java app server behind IIS. Using the following rules I can rewrite static pages just fine, but alas, websocket connections are never established:
Mirco
  • 53
  • 1
  • 5
3
votes
1 answer

No protocol handler was valid for the URL / (scheme 'ws')

Trying to setup a websocket proxy using apache2, I get the following error: No protocol handler was valid for the URL / (scheme 'ws'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration…
Mohsen Saberi
  • 95
  • 1
  • 3
  • 7
3
votes
1 answer

Nginx: proxy_set_header "Upgrade" slows down the server

I have a site that I'd like to enhance with using WebSocket based features. The site is behind an Nginx reverse proxy. My config for the server looks like this: location / { proxy_set_header X-Forwarded-Server $host; …
László Stahorszki
  • 260
  • 1
  • 5
  • 16
3
votes
1 answer

An Issue with an AWS EC2 instance when connecting it to WebSocket

As I tried to run the chat app from localhost connected to MySQL database which had been coded with PHP via WebSocket it was successful. Also when I tried to run from the PuTTY terminal logged into SSH credentials, it was displaying as Server…
3
votes
1 answer

nginx setup for wss:// keep getting 301 redirects

Can't get wss:// (or ws://) working on my Digital Ocean, Ubuntu server using nginx, keep getting 301 redirect and no connection. Websocket server: node + express + uws served on http://localhost:3000/chat (I have tested it by opening up 3000 in ufw…
Michael Dausmann
  • 133
  • 1
  • 1
  • 5
3
votes
1 answer

How to troubleshoot Nginx 499 when it's not returning a web sockets handshake back to the client?

In a Kubernetes cluster, I have an Nginx server acting like a reverse proxy / TLS termination solution that proxypass requests to a backend Tomcat application that has some functionalities powered by Web Sockets (SockJS / Stomp). Unfortunately, the…
theMarceloR
  • 159
  • 1
  • 1
  • 7
3
votes
0 answers

NGINX Websocket initial communication delay

I've created a Django server that is making use of django-channels for websocket communication. When I run the server with NGINX there is an initial delay in websocket communication between the server and the client. After the initial delay all the…
MCBama
  • 131
  • 4
3
votes
0 answers

Confluence (Synchrony) using websockets behind IIS8 can't copy or insert large blocks of text

I've got a Confluence 6.1.0 setup running behind an IIS8 reverse proxy doing SSL. Everything works except for one small problem. When I try to copy a three or four paragraphs of text, attempt to copy a table, or attempt to insert a new table larger…
meeper
  • 43
  • 4
3
votes
2 answers

nginx as proxy for WebSocket: inspect and block certain requests

I ran NodeJS as a kind of Webapplication Server serving an AngularJS frontend. They communicate solely over WebSockets, using the SailsJS implementation of Socket.IO. Between frontend (client) and the NodeJS backend, sits nginx as a proxy,…
cis
  • 247
  • 1
  • 2
  • 9
3
votes
2 answers

Apache 2.4.7 mod_proxy_wstunnel tunneling too much (HTTP as well as WS)

I'm running Apache 2.4.7 as a reverse proxy on Ubuntu 14.04 LTS. This Apache server acts as the entrypoint to a lot of different backend applications, which are accessed via different mod_proxy configurations in blocks I need to provide…
Brian Beckett
  • 509
  • 1
  • 4
  • 12
3
votes
1 answer

WSS Load Balancing with SSL Termination at layer 4

Should it be possible to terminate SSL for wss (secure websockets) at a layer 4 load balancer? Seems to me that wss (and ws) in general would require TCP routing since an HTTP reverse proxy wouldn't be able to make sense of the packets; and, SSL…
rbinion
  • 31
  • 1
  • 2
3
votes
1 answer

NGINX Proxy Setup for ws:// protocol

I am trying to setup NGINX to proxy web socket traffic. I am running a web page on NGINX (port 80) that has an MJPEG feed from port 8080 and also takes web socket traffic over port 8090. I can proxy the MJPEG stream, but not the web sockets. In my…
user383341
  • 31
  • 1
  • 1
  • 2
1
2
3
13 14