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
0
votes
0 answers

Can't connect to WebSocket server over wss:// (ws:// works), and no debug information

I have a website on example.com, and a WebSocket server on example-websocket-server.com. Each have an SSL certificate so that I can access them from https:// I am using the websocket server as a websocket server for all the other websites, including…
pileup
  • 229
  • 2
  • 9
0
votes
0 answers

Different port forwarding for https and wss (Websocket) using firewalld

Currently I setup port forwarding for a nodejs server such that all http requests (using tcp protocol) get redirected from port 80 to 3000, and all https requests (using tcp) get redirected from port 443 to 8080. The nodejs application also needs to…
VIVEK
  • 53
  • 1
  • 4
0
votes
1 answer

work with AWS ELB to keep websocket connections during server restarting?

So we have a server application which communicates with clients through websocket and we need to regularly upgrade our server app binary. We may have multiple server instances, I know that I can offline the instance I'm upgrading but you know since…
cifer
  • 101
  • 5
0
votes
0 answers

Nginx upstream wss proxy SSL_read() failed (SSL: error:0A000126:SSL routines::unexpected eof while reading)

What I need is Client <--wss---> nginx <--wss--> server I am doing a wss proxy, I have already got it working on Apache but I want to switch to nginx now here's the apache config: ProxyPass…
Steve Moretz
  • 173
  • 1
  • 9
0
votes
2 answers

HTTP and websocket on the same port and domain behind reverse proxy

I wanted to try Node-Red and have installed it on my Ubuntu server. This server runs an apache reverse proxy but I can't get it to work right. If I create a virtualhost for the HTTP connection I can access my Node-Red interface just fine, but it…
0
votes
1 answer

How do I setup a SSL certificate for an express.js server behind a load balancer?

I'm restructuring my server structure by splitting them up instead of running everything from one server. I looked here but that just specifies what I were already doing in the original setup with just 1 server. I'm having a structure like this: 2x…
ii iml0sto1
  • 101
  • 2
0
votes
1 answer

After establishing WebSocket tunnel, does NGINX continue to 'be in the loop'?

I have a WebSocket server-side application fronted by an Nginx reverse proxy and all is working great. The WS app runs in a container as does Nginx, and both then work together as a service. Now I'm considering the scale-up rules for the WS app,…
mmuurr
  • 135
  • 1
  • 5
0
votes
0 answers

haproxy between http-only client and websockets only backend

odd request maybe, but I have a need to proxy between a HTTP-only client and a WebSocket-only server. these are not long-lived connections; the client does a POST with some binary data that needs to be forwarded to the ws:// server and the response…
Marvin
  • 1
0
votes
0 answers

How do I get SignalR server deployed on AWS EKS behind nginx to allow websocket protocol connections?

I have a .NET 6 Web API with SignalR. Everything works perfectly when connecting directly to the API - locally as well as via Endpoint IP:Port on AWS EKS. However, it's failing to connect specifically via the websocket transport method when I try to…
0
votes
1 answer

SIP Websocket to UDP proxy server

There is an ATS provider with SIP phones. It provides phones via UDP, as I understand, giving sip server, login and password for each internal call-line. I want to write a site with browser calls ability. As I understood, searching the web, I can't…
Ngdgvcb
  • 1
  • 1
0
votes
2 answers

Does apache ProxyPass handle tls for websocket too?

I'm new to proxypass, Let's say this is our config: # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating …
Steve Moretz
  • 173
  • 1
  • 9
0
votes
0 answers

Nginx and WebSocket Unexpected server response: 400

I'm trying to deploy a NodeJS websocket server to my Cent OS machine which running Nginx, I'm trying to make socket.mydomain.com for the socket and I used the following configuration for nginx map $http_upgrade $connection_upgrade { default…
0
votes
0 answers

Websockets failing without error message

I have a NginX server running two nodeJs applications, Let's call them A and B. Both applications are working correctly for websockets on my local machine, and https calls are working on the server for both applications, but websockets are only…
Michael
  • 105
  • 3
0
votes
0 answers

Nginx: Websocket on port 80 is not working

I have a simple NodeJs Websocket application running, the code for it is // Importing the required modules const WebSocketServer = require('ws'); // Creating a new websocket server const wss = new WebSocketServer.Server({ port: 8090 }) // Creating…
Bidyut
  • 121
  • 3
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
  • 37
  • 5