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

WebSocket Connection vs. Repeated GETs

I am prototyping an application using nodejs. But this question refers to hypothetical large scale roll out. What is more demanding on a server and/or bandwidth: WebSocket stay alive connections or repeated client HTTP GET requests? For example…
Ross
  • 153
  • 1
  • 1
  • 7
2
votes
1 answer

How to configure streamlit to serve an app to www?

streamlit app is running in a centOS stream 8 virtual machine. Access from intranet is fine but fails with "streamlit please wait.. page" when accessed from www via subDomain.companyDomain.com Tested R shiny app and a static page from same virtual…
384X21
  • 121
  • 6
2
votes
1 answer

How to fix ws and socket.io memory leak?

I have read that there is a memory leak occurring in both node.js websocket modules ws and socket.io. It has existed for years and am wondering how to fix it. It is mentioned in the following, to name a…
Normajean
  • 131
  • 2
  • 5
2
votes
1 answer

Tomcat servlet will not complete websocket connection

I am moving a set working servlets from one server to another Old server, Centos6, Apache 2.2, Tomcat 9 New Server, Centos7, Apache 2.4, Tomcat 9 I have about 5 servlets running from the old server all are OK, except the one servlet that has 3…
ScottD
  • 21
  • 5
1
vote
1 answer

Connecting to websocket on Google Cloud Run docker container

I'm rather a newbie to GCP so please forgive my ignorance. I'm trying to connect a few bits together, namely: A Node instance running on App Engine A ChatScript instance running on Cloud Run with a Dockerfile An SQL instance running on Cloud…
1
vote
1 answer

Apache error "ProxyPass unknown Worker parameter" when using "upgrade=WebSocket"?

I am trying to relay the WebSocket connection of V2Ray with Apache according to This post, and the snippet below worked before. ProxyPass ws://127.0.0.1:{port}/{ws_path}/ upgrade=WebSocket ProxyAddHeaders Off …
whc2001
  • 25
  • 1
  • 5
1
vote
0 answers

Socket.io proxy through Apache and its performance

I am trying to setup a server for a Socket.IO game, but we will also have a little landing page in php served through Apache. I managed to make the server work by doing a proxy from Apache to the Socket.IO app. Apache is running on :80 and node on…
1
vote
0 answers

TLS websocket proxy with deep packet inspection/traffic logging

I have a very specific scenario in which maschines (IoT) are communicating with a central server over websockets. I need to inspect the websockets traffic (wss/tls) for audit and monitoring reasons (especially troubleshooting). We can't do it on the…
Kitano
  • 11
  • 2
1
vote
0 answers

WebSockets + Apache and Nginx in “reverse proxy mode” + SSL/secure

As I had tried to connect PHP WebSocket from socketme.io through HTTP, since it was successful and again after loading certificates and making HTTPS it didn't work. As my hosting server's nginx is configured to work in proxy mode When website URL is…
1
vote
0 answers

HTML5/WebSocket Issues Windows Server 2011/2012/2016

We are having a strange issue with running a customer application but only on Windows Server machine, I did highly contemplate posting this to StackOverflow but as I suspect this to be a server configuration issue I felt it was best placed here…
1
vote
1 answer

wss not working in https but ws works in http apache2 ubuntu

My websocket setup works in http. But if I enable ssl(lets encrypt) and change the ws:// to wss://, browser throws this error. WebSocket connection to 'wss://xx.yy.xx.yy:5001/' failed: Error in connection establishment:…
krkart
  • 235
  • 2
  • 3
  • 10
1
vote
1 answer

Websocket working within LAN but 502 error from remote client with nginx proxy

I have this really frustrating problem where my server which consists of an nginx reverse proxy and django/channels/daphne websocket host is functioning within the local LAN but from a remote client only the websocket connection can't be…
Chris
  • 113
  • 5
1
vote
0 answers

Using Apache to relay wss (web-socket) protocol to backend

I'm using Apache 2.4.27. I need to tunnel a client's wss request through an Apache reverse-proxy, to a backend server. However, from a tcpdump, it appears the wss request is being rejected by the Apache server. So I'm trying to debug this first…
1
vote
0 answers

Amazon AWS WebSocket Load Balancing Scale-In

We are in the process of developing a WebSocket application that will run on the same application servers that serve our APIs, which are all within a target group of a new Amazon Application Load Balancer. I'm not certain that a sticky session would…
1
vote
0 answers

Azure App Service Deployment not closing Node.js WebSockets connection

Background I'm having trouble with an Azure App Service Deployment. I'm using VSTS to do the deployment using the Azure App service Deploy feature. I'm deploying a Docker container to a Linux App Service slot. The Docker container is running a…
Sawtaytoes
  • 143
  • 8