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

185 questions
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
  • 5
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

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

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
  • 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
3
votes
1 answer

nginx proxy_pass two ports into subfolders

So I had my last "reverse proxy" problem fixed regarding "mapping" a port to a subfolder Thanks again to this awesome community. I have been able to work with this solution for a while but now I am facing a new problem. The situation is: There is a…
pAt84
  • 301
  • 1
  • 2
  • 6
3
votes
1 answer

Increase client timeout for WebSocket connections to certain URL

On CentOS 7 Linux I successfully use HAProxy 1.5.14 in front of Jetty 9 serving a Wordpress site via FastCGI. It works really well, but for a HTML5/WebSocket game at the same website much higher client and server timeouts for WebSocket connections…
Alexander Farber
  • 714
  • 4
  • 16
  • 38
3
votes
1 answer

Nginx reverse proxy + URL rewrite + websockets

I saw this Question, but it doesn't seem to work for me. Current (working) situation is: server { listen 443 ssl; server_name updates.example.com; ssl_certificate fullchain.pem; ssl_certificate_key privkey.pem; location…
ZioByte
  • 246
  • 3
  • 15
3
votes
1 answer

Error 404 when connecting to websocket behind nginx proxy_pass

I would like to serve up a websocket behind a location on my webserver. For example, if my domain is http://mydomain I would like my websocket to be available at ws://mydomain/ws. I am running a local websocket server on port 8080, and I can connect…
2
votes
0 answers

(105: No buffer space available) while connecting to upstream,

The server is returning 500 error. And in the logs I see many records like (105: No buffer space available) while connecting to upstream Tried to restart server : didn't help. Increased the number of sockets : didn't help. VPS, running Ubuntu…
Alexander P
  • 139
  • 6
2
votes
0 answers

Any reasons against a very high value in proxy_send_timeout for websockets?

I use nginx as an ingress controller in Kubernetes. I have a websocket connection between 2 applications which you should stay open indefinitely. There is a reconnect mechanism but that should be avoided as much as possible. Currently, the nginx…
wrdls
  • 21
  • 1
1
2
3
12 13