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

Error 200 during WebSocket handshake: Aws load balancer + ec2 websocket

I'm using load balancer in front of an aws ec2 instance(I will have more in future). In this ec2, I have a website being served by nginx on port 80, a nodejs app listening on 8080 and the websocket on 4555. My nginx.conf has rules to pass the…
2
votes
1 answer

Allow Websocket connections on Google Cloud Platform

We have a GCE project, with several servers behind a loadbalancer. The servers are running a NodeJS HTTPS server. We have recently tried to implement websocket support, but can't seem to connect to it from behind the loadbalancer. As soon as the…
2
votes
1 answer

Nginx timeout for websocket

I'm connecting a client with websocket through Nginx (as a reverse proxy) to an asp.net core application. Between server and client there are heartbeat commands to keep websocket connection open. My Problem is when a client disconnects by unplugging…
Mathias
  • 121
  • 1
  • 5
2
votes
2 answers

NGINX Proxy pass to WebSocket and PHP not working with SSL

I'm trying to route requests in Nginx in the following way: Requests made to / should go to a PHP script (proxy.php, which itself is a proxy) Requests made to /websocket should be proxied to http://localhost:4000/websocket All other requests…
2
votes
2 answers

Cannot get websocket connection working with ec2 + application load balancer

I have an aws application load balancer with an https listener on port 9999, forwarding to a group on port 9999 with an ec2-instance being the target. If I run my websocket server with the host name configured to my domain api.example.com, then when…
2
votes
0 answers

websocket cannot connect via apache reverse proxy

I am using the terminado and i am running the unique.py inside the demo folder on port 9090 from inside a docker container with a ip of 172.17.0.2 So i have set up a reverse proxy using apache2: ServerAdmin…
2
votes
0 answers

Websocket Error in connection establishment: net::ERR_CONNECTION_REFUSED 'wss://'

First I asked this question in stackoverflow, but it looks like a server issue more than coding problem. I am developing a project with Java EE and I have access to the server computer under a university LAN. Just to give details I also add my codes…
tonder
  • 21
  • 1
  • 1
  • 2
2
votes
1 answer

Enabling WebSockets (SignalR) with a Barracuda WAF

I am currently tearing my hair out at work trying to resolve an issue with a web application that uses SignalR over WebSockets where traffic is directed through a Barracuda Web Application Firewall (WAF). Every attempt to connect to the…
jonhoare
  • 201
  • 1
  • 9
2
votes
0 answers

Windows server 2016 does not accept incoming WebSocket connections

I have started a websocket server with nodejs on my windows server 2016. The nodejs application started listening on port 1337 and I can initiate websocket connection to my localhost:1337 from browser side. But when I try to initiate a connection on…
2
votes
1 answer

Proxy websocket with parameters through proxypass/proxypassmatch without a VirtualHost

I have been trying for the longest time to proxy a websocket with it's sid variable to the localhost service, that is serving it. I have looked far and beyond for a solution (including a lot of the questions here), but most of them suggest to use a…
smsimeon
  • 21
  • 1
2
votes
1 answer

Secure Web Socket connection on ejabberd

I am running ejabberd 17.12. It works fine. With this config, I manage to open non-secure web socket connections to it from my browser using both the JS console and a XMPP client : port: 5280 ip: "::" module: ejabberd_http request_handlers: …
2
votes
1 answer

Web app can't connect to websocket server

I have a web app running on HTTP server on port 3000. This app is connected to a websocket server on port 9001. Both WS and HTTP servers are located inside the same VM. When testing the app locally (inside VM), everything works fine. Both web app…
2
votes
0 answers

WebSocket In SYN_SENT State

Redirected from NE, I have a problem in establishing a connection with using websocket. netstat console output FYI, the target that we wish to connect to is 10.121.244.17:45678 which is an instance of socket server. The problematic executable is…
2
votes
2 answers

Apache Cluster + Tomcat websocket

We've recently configured a new Cluster with the following configuration: www.mydomain.com | APACHE + MOD_JK (AJP) Load Balancer / \ Tomcat1 Tomcat2 All the requests are made through HTTPS and…
Medioman92
  • 123
  • 4
2
votes
1 answer

Apache2 WSS-rewrite

Trying my luck her as StackOverflow was not the right place to ask. Hopefully this is where my question belongs! I have been pulling my hair the last few days getting websockets to work with Apache2.4. I finally found a solution that worked for me,…
Erik
  • 21
  • 1
  • 3
1 2
3
12 13