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
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
  • 5
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
  • 177
  • 1
  • 7
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
  • 3
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
  • 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…
1
vote
2 answers

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
  • 219
  • 4
  • 15
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
1
vote
1 answer

Nginx proxy websocket: is it required to close the connection to backend after upgrading to a websocket?

Base on what I could read on nginx site https://www.nginx.com/blog/websocket-nginx/ The exemple they give will close all connections to backend. This isn't really what we want on a proxy setup, forcing to reopen a connection to backend on each new…
Antony Gibbs
  • 425
  • 2
  • 12
1
vote
0 answers

Channels current state is disconnected(laravel-websocket on ubuntu Host server)

I am working on Laravel-websocket package i got stucked on this error from quite long time. i have configure basic laravel procject along with laravel websocket package on my local ubuntu as well as digitalocen ubuntu host server.I did same…
Gopi
  • 11
  • 1
1
vote
0 answers

Apache reverse proxy to websocket in same context as http

I have an Apache/2.4.6 installation working as a reverse proxy for some applications. Now I have to configure another one. HTTP proxying is working great, but in some sections of the webpage, the client tries to start a websocket connection. The…
Mike B
  • 370
  • 2
  • 4
  • 20
0
votes
1 answer

Ejabberd MUC room not sending unavailable presence for disconnected users

I'm running ejabberd 19.09.1 using the official Docker image, configured for anonymous authentication with mod_muc. Clients generally connect to the server in the browser, through a WebSocket endpoint. ejabberd is sitting behind an nginx reverse…
0
votes
1 answer

Cannot establish Websocket on AWS

I have a webserver running on an EC2 instance behind an AWS load balancer under a custom domain for using https. Curl requests to the webserver work as expected, including over https. But establishing a websocket connection fails with the following…
0
votes
1 answer

TCPDUMP, tcp Flag not changing from Flags [S] to other flag values

I need support understanding these lines. when i tried to connect to server in a particular port it shows connecting and gives me timeout error. But in the tcp-dump command the packet flag not changing from [s] to other flags. Review the below log…
VinothRaja
  • 101
  • 1