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

NGINX double proxy not allowing websocket connections

I have two nginx proxies setup on my machine, one to unwrapp SSL and the other to do application-specific proxying (only the second one is version controlled). When I only had one proxy I was able to make successful websocket connections, but after…
Simon Richard
  • 33
  • 1
  • 3
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…
Justin Gilman
  • 151
  • 1
  • 4
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
  • 1
  • 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
2
votes
0 answers

Error 200 during WebSocket handshake: Aws load balancer + ec2 websocket

I'm using load balancer in front of an aws ec2 instance(I will have more in future). In this ec2, I have a website being served by nginx on port 80, a nodejs app listening on 8080 and the websocket on 4555. My nginx.conf has rules to pass the…
2
votes
1 answer

Allow Websocket connections on Google Cloud Platform

We have a GCE project, with several servers behind a loadbalancer. The servers are running a NodeJS HTTPS server. We have recently tried to implement websocket support, but can't seem to connect to it from behind the loadbalancer. As soon as the…
2
votes
1 answer

Nginx timeout for websocket

I'm connecting a client with websocket through Nginx (as a reverse proxy) to an asp.net core application. Between server and client there are heartbeat commands to keep websocket connection open. My Problem is when a client disconnects by unplugging…
Mathias
  • 121
  • 1
  • 5
2
votes
1 answer

How to accept HTTPS and Websockets on a new Google Kubernetes Engine deployment?

I set up a simple 1-node GKE deployment with the default (beta) ingress, created via the GCP console. I would like to set up a Google-managed SSL certificate and HTTPS proxy to the a single GKE node & service hosting HTTP & WebSockets. There are…
2
votes
2 answers

NGINX Proxy pass to WebSocket and PHP not working with SSL

I'm trying to route requests in Nginx in the following way: Requests made to / should go to a PHP script (proxy.php, which itself is a proxy) Requests made to /websocket should be proxied to http://localhost:4000/websocket All other requests…
Rico Leuthold
  • 71
  • 1
  • 6
2
votes
2 answers

Cannot get websocket connection working with ec2 + application load balancer

I have an aws application load balancer with an https listener on port 9999, forwarding to a group on port 9999 with an ec2-instance being the target. If I run my websocket server with the host name configured to my domain api.example.com, then when…
2
votes
0 answers

websocket cannot connect via apache reverse proxy

I am using the terminado and i am running the unique.py inside the demo folder on port 9090 from inside a docker container with a ip of 172.17.0.2 So i have set up a reverse proxy using apache2: ServerAdmin…
Satnam Sandhu
  • 121
  • 1
  • 4
2
votes
0 answers

Websocket Error in connection establishment: net::ERR_CONNECTION_REFUSED 'wss://'

First I asked this question in stackoverflow, but it looks like a server issue more than coding problem. I am developing a project with Java EE and I have access to the server computer under a university LAN. Just to give details I also add my codes…
tonder
  • 121
  • 1
  • 1
  • 2
2
votes
1 answer

Enabling WebSockets (SignalR) with a Barracuda WAF

I am currently tearing my hair out at work trying to resolve an issue with a web application that uses SignalR over WebSockets where traffic is directed through a Barracuda Web Application Firewall (WAF). Every attempt to connect to the…
jonhoare
  • 201
  • 1
  • 9
1 2
3
13 14