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
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
  • 2
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
  • 1
  • 4
2
votes
3 answers

IP Tables intercept exception

I've got a set of iptable rules that look like this: -A PREROUTING --jump intercept-nat -A intercept-nat --jump DNAT -s 10.10.1.0/24 ! -d 10.10.1.1/32 -p tcp -m tcp --dport 80 --to-destination 10.10.1.1:3126 -m comment --comment "intercept-nat" -A…
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
2
votes
0 answers

proxy_pass to websocket behind nginx

I got websocket servers and there are behind nginx. I need to configure second nginx as proxy to this first nginx. But when I make a request, there is an error 400 or 404 (with different configs). Here is my config of my nginx: map $http_upgrade…
Grzonu
  • 21
  • 3
2
votes
1 answer

Does Apache process handling Websocket proxy also serve same client for http?

In choosing to adopt Websocket as the real-time technology behind a web application for my company, I'm trying to determine what the server workload will be. So far as I understand Apache internals, I believe an Apache process or thread will be kept…
Some Dude
  • 83
  • 2
2
votes
1 answer

Can not using websocket with nginx

I am using Activemq as broker, client side is Paho js to send websocket request(ws protocol). Everything work fine on server, but when the server start to set nginx as proxy, the client can not connect to server( but I can connect to Activemq UI…
Rong Nguyen
  • 121
  • 5
2
votes
1 answer

Websocket reverse proxy with nginx: Error about request in server log, but works in browser

The situation I am running Etherpad, which is proxied via nginx. Etherpad uses Websockets with Socket.io. My nginx config is more or less this one. The location block for socket.io is this: rewrite /CustomSubDir/socket.io/(.*) /socket.io/$1…
rugk
  • 506
  • 2
  • 6
  • 18
2
votes
3 answers

Configure Meteor in a server without websocket support

I was asked to test a meteor (js) website in a server without websockets support, how can I achieve this? How can I really know that a server is not capable of using websockets?
w3jimmy
  • 143
  • 6
2
votes
1 answer

How does nginx websocket proxy work?

I'm wondered about how nginx handles tons active websocket connections? There is a lot of limitations, like a number of open files, maximum of 65k TCP connections between IP <-> (IP, port) and so on. When I'm using nginx as reverse proxy and have,…
2
votes
0 answers

Sticky sessions with Apache load balancer for Socket.io 1.0

I've been messing around with Apache as a load balancer for my Socket.io server. I went through the following topic and now everything seems to be fine. Configuring Apache 2.4 mod_proxy_wstunnel for Socket.IO 1.0 I configured Apache using the…