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
1
vote
0 answers

Websockets behind Apache and Nginx proxy connection not upgraded

I have a problem. Apache listens on a white ip and proxies all requests /ssd on nginx that proxies requests /city-dashboard to another server with websockets. In apache config: ProxyPass /ssd/ http://10.127.32.24 ProxyPassReverse /ssd/…
reddaemon
  • 11
  • 3
1
vote
0 answers

Scaling AngularJS + NodeJS app on Linode

I have developed an application using AngularJS + NodeJS (together with MariaDB, Redis and Socket.io for realtime notifications) and I have deployed it on a single Linode node. Now I would like to organize the architecture in a way I can easily…
Giorgio
  • 19
  • 1
  • 2
  • 4
1
vote
3 answers

How would I configure a websocket server to run alongside a webserver?

I currently have a Apache2 listening on port 80, and a homemade game server running on higher unregistered port (50214). I an rewriting the game in Javascript and planning on sending the network communication over websockets on port 80 to get around…
Nathan
  • 258
  • 2
  • 4
  • 10
1
vote
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
  • 111
  • 4
1
vote
2 answers

How do I configure reverse proxy for WSS support on a different port?

I'm using the vaultwarden docker container, which basically requires a reverse proxy to provide SSL. The container runs a separate web server for Websockets, because Rust's rocket doesn't support web sockets on the same port. The instructions for…
John
  • 151
  • 6
1
vote
1 answer

How to use smart websocket client from Windows to connect to a running websocket server on virtualbox?

Here is my setup: Windows 8.1 with Ubuntu 18.04 within VirtuablBox 6.0 Run a websocket server at 127.0.0.1:8083 within VirtuablBox Within the VirtuablBox, I can connect to the websocket server with websocat ws://127.0.0.1:8083 What is the setup I…
q0987
  • 81
  • 6
1
vote
0 answers

PHP Websocket in a SSL-enabled website served by apache

I have the following WebSocket code in PHP, which works well when connecting to it by using plain-text ws:// but when I try to connect to it from a front-end Javascript in my SSL-enabled website I get the "mixed content error". I am trying to find a…
CDoc
  • 111
  • 4
1
vote
0 answers

Websocket from one HAProxy backend to another backend fails

I have two backends (b1, b2) sitting behind the same frontend (f1) in HAProxy, routing based on host name. I can establish websocket to both b1 and b2 from my laptop, however if I try to establish websocket to b2 from b1 (through f1) I get 1006…
Ryan
  • 187
  • 1
  • 1
  • 8
1
vote
1 answer

Replicate nginx reverse proxy config using apache

nginx config: server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /path/to/tls/tls.crt; ssl_certificate_key /path/to/tls/tls.key; server_name the.domain.tld; location / { proxy_pass…
TREX
  • 21
  • 4
1
vote
2 answers

How to open a socket on EC2 instance?

I want to send webcam video from my laptop to aws EC2 instance. I'm trying to follow suggestions from here and code from here. The issue I'm facing is that I do not know how to open a socket and listen to incoming traffic on EC2. My EC2 is a Amazon…
mirzaD14
  • 13
  • 1
  • 4
1
vote
0 answers

RabbitMQ Stomp one central Node or domain based?

We have a server with about 400 instances of an application, each of these instances has its own domain. We want to set up a RabbitMQ(other server) , also Stomp(websockets) for the Frontend and amqp through the backend application. We have the…
demonking
  • 131
  • 3
1
vote
1 answer

WSS Connectivity issue on production

I am using Angular8 as frontend and Nodejs as backend I have Configured WSS on production ,but connection with client not working properly, In one page connection is working but in another page connection not working. websocket and server is running…
1
vote
0 answers

Jitsi Meet in Docker Container: Websocket error

(I asked this question on StackOverflow yesterday, but I didn't receive an answer yet, and maybe Serverfault is a better platform for this question. Also I can't post pictures here, but I hope the question is clear without them. If not, please look…
anonymus1994.1
  • 175
  • 1
  • 6
1
vote
1 answer

Can Nginx limit incoming websocket message size?

In the JS WebSocket library, you can limit the maximum allowed incoming message size via the maxPayload option. I'd like to impose this limit in my Nginx reverse proxy layer, before it gets to my application server. Does Nginx have a similar…
rynop
  • 239
  • 4
  • 16
1
vote
1 answer

Can Apache-2.4 hand off a client connection to a PHP script that speaks WebSocket to the client?

I have an Apache-2.4 web server. It will execute PHP scripts if a client requests https://my.domain.com/script-name.php, and the output of the script shows up in the browser window. (Or it can be retrieved as AJAX data by Javascript.) I would like…
Dave M.
  • 111
  • 3