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
0
votes
1 answer

Keep connections of closed instances behind a load balancer

I'm looking for a system to create a live sockets application through sockets.io and that can be balanced without problem. There are tons of solutions to balance the load between multiple socket instances, like SocketCluster, but the problem I'm…
0
votes
2 answers

How can I secure an insecure Meteor by using Nginx?

I have an insecure Meteor running on AWS. For those not familiar with Meteor, that means I am using the "insecure" package, which trades security for rapid prototyping. I only need our development team and stakeholders to access the server. In the…
Ruby
  • 129
  • 1
  • 3
0
votes
1 answer

docker container port forwarding behavior for `run` command (for websockets)

I am running an ipython notebook server inside a docker container. Running code inside the notebook from the browser works over websockets, which have to connect from outside the container (a browser) to the tornado server running inside. I noticed…
user1248490
  • 103
  • 3
0
votes
0 answers

mod_proxy_wstunnel Status line does not end with CRLF

I'm using Apache 2.4.9 with mod_proxy_wstunnel and Proxy balancer to load balance between two websocket servers. I have a Spring Websocket Server to which my client is able to connect without any issues. The moment I add Apache web server with…
0
votes
1 answer

Nginx does not stop with websocket connection

I have nginx 1.6.2 wih configuration to upgrade connection to websocket. proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; When no websocket connection is opened, "service nginx stop" works, both master and worker…
Bastien974
  • 1,824
  • 12
  • 43
  • 61
0
votes
0 answers

What to do if your websocket based app inside a docker cannot do WSS, will reverse proxy with NGINX work?

I'm on a journey to figure out if and how to use NGINX as a reverse proxy for an app server in a docker that needs WS, but we need the clients to use a secure WSS connection. At first I thought of just using a WSS to WS NGINX reverse proxy. We…
gwhiz
  • 5
  • 2
0
votes
0 answers

How do I configure IIS so that websocket conenctions are handled by an external program?

I can't really get my head around how websockets are configured and expected to work on the server. In my case I have a machine (Windows 10) running IIS. On that machine I want to place my own websocket server application (WS-Server.exe), which…
Magnus
  • 101
  • 2
0
votes
1 answer

kubernetes pod with a socket connection not firing 'close' event

I have a Kubernetes deployment where a pod connects to a client via TCP Socket. On connect and disconnect different events happen. In the dev environment the server can respond to connections, data, and end, but in the production environment it only…
0
votes
0 answers

Websocket Nodej which is better Apache2 Or Nginx for ubuntu instance

I'm working on a project where I have to use websocket apis in nodejs to update data in real time, such as open orders, pricing updates, and other things. Since my front end is react and I need to create a subdomain like api.example.com, I was…
0
votes
0 answers

Loadbalancing websockets with nginx behind haproxy

I have an Nginx instance which serves requests proxied to it from an haproxy. This instance should balance load between several websocket server. To get better performance the load balancing should be sticky and so i used ip_hash as the load…
mhk
  • 101
  • 2
0
votes
1 answer

What happens to existing HTTP and Websocket connections when the NGINX configuration reloads?

Let’s say we have a pretty standard blue/green deployment setup. NGINX is currently proxying all traffic to the live server (BLUE). We then deploy an updated version of our code to the idle server (GREEN). Finally, we refresh the NGINX configuration…
0
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…
0
votes
0 answers

Optimize small Websocket messages with nginx "tcp_nopush off"?

I'm currently using nginx as a reverse proxy for a websocket server that very frequently broadcasts tiny messages; often 1 - 2 bytes in length. I'm trying to minimize latency as much as possible. It's commonly recommended that tcp_nopush on; be set…
0
votes
0 answers

Websocket error - Parse live sync

We recently moved from Cloudfare to Akamai and started seeing below error - ParseLiveQuery: WebSocket did disconnect with error: Optional(Starscream.WSError(type: Starscream.ErrorType.upgradeError, message: "Invalid HTTP upgrade", code:…
Vidya
  • 1
0
votes
0 answers

Can't establish wss connection [React + ASP.NET Core, SignalR + nginx]

I have React app that talks to Asp.Net core API. Both of them are deployed on Docker on my VM. Nginx is installed and configured to resolve domain names for app (thesis.uno - for react app, api.thesis.uno - for asp.net core api) I added chat support…