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

Issue deploying Flask Rest Api on Nginx

I'm trying to deploy my flask api rest on nginx (on a subdomain) without success. I've followed this example from Digital Ocean and everything was working properly but then I changed the tutorial example code to my mine and POST requests aren't…
NeoSennin
  • 51
  • 6
1
vote
1 answer

How do I forward websocket communication through an intermediary server?

I'm trying to connect a websocket server (linux machine) and client (web browser) through an intermediary server (hosted on an AWS EC2 instance). The EC2 instance provides a public IP that the websocket server and client can reference. My client…
Nick Sweet
  • 113
  • 1
  • 4
1
vote
0 answers

WebSockets with TeamCity behind Amazon ELB

I'm setting up TeamCity behind a public ELB in Amazon. I am attempting to fix the WebSocket connection issue: Some users cannot use optimized web UI updates via WebSocket protocol. This is a standard, default install of TeamCity listening on port…
Thomas Farvour
  • 141
  • 1
  • 1
  • 3
1
vote
0 answers

When does the Nginx error happen, recv() failed (110: Connection timed out) while proxying upgraded connection

I am using Nginx 1.10.1 for my APP to balance connections on Websocket. For example, the App A(multi-process) establish Websocket connections to B1, B2 through Nginx so that the connections could be balanced. While using it, sometimes even though…
asleea
  • 159
  • 1
  • 1
  • 8
1
vote
0 answers

nginx SSL termination with sticky load balancing

I want to use Nginx with a socket.io app with TLS/SSL termination at the load balancer. Is it possible to use the ip_hash directive to do sticky loadbalancing in combination with TLS/SSL termination? My application only uses HTTPS. I could not find…
Leo
  • 31
  • 1
  • 4
1
vote
0 answers

Apache reverse proxy sometimes takes over all requests

I am using my apache as a reverse proxy for a few requests to a webserver running on an internal port to allow access via my regular virtual host. This is on an ubuntu 15 running in vagrant. Here's my virtualhost config:
Christof
  • 121
  • 3
1
vote
0 answers

Configure a websocket server in front of HAProxy

I have a small python server script which creates a websocket connection and accepts base64 encoded IP packets (very similar to this). As of now my script decodes the IP packet and sends it out into the wild acting as a proxy. It attempts to…
Dan Ramos
  • 111
  • 3
1
vote
3 answers

Apache proxy all ws connections to different port

In my Apache 2.4 vhost I'm trying to get all https:// traffic to carry on to port 443, but all ws:// traffic to forward onto ws://*:6969. Eg: https://example.com/index would just go to https://example.com/index:443 as…
KapowKi
  • 11
  • 1
  • 3
1
vote
0 answers

How should I set up my sub-domain to allow it listen on a port for web socket transfer?

This may be a really beginner question, but I really want to make sure I'm going in the right direction before investing time in this. Heres what I have. charlieli.me @ 45.55.33.185:80 fileserver.charlieli.me @…
lzc
  • 111
  • 1
1
vote
1 answer

Apache wstunnel_proxy not working

I am trying to connect to my websocket server using html 5 websockets. The direct connection works fine, but when I try to hide my server behind apache proxy it does not work. it ends up: var ws = new…
Dusan Plavak
  • 143
  • 6
1
vote
1 answer

Nginx doesn't start Passenger/Nodejs

I cannot get Passenger to start my Nodejs (iojs) application on restarting nginx. I've followed the tutorials and installed the prerequisites: $ nginx -V nginx version: nginx/1.8.0 configure arguments: --with-cc-opt='-g -O2 -fstack-protector…
Maruf
  • 159
  • 9
1
vote
0 answers

Websockets behind Apache and Nginx proxy connection not upgraded

I have a problem. Apache listens on a white ip and proxies all requests /ssd on nginx that proxies requests /city-dashboard to another server with websockets. In apache config: ProxyPass /ssd/ http://10.127.32.24 ProxyPassReverse /ssd/…
reddaemon
  • 11
  • 3
1
vote
0 answers

Scaling AngularJS + NodeJS app on Linode

I have developed an application using AngularJS + NodeJS (together with MariaDB, Redis and Socket.io for realtime notifications) and I have deployed it on a single Linode node. Now I would like to organize the architecture in a way I can easily…
Giorgio
  • 9
  • 1
  • 2
  • 4
1
vote
3 answers

How would I configure a websocket server to run alongside a webserver?

I currently have a Apache2 listening on port 80, and a homemade game server running on higher unregistered port (50214). I an rewriting the game in Javascript and planning on sending the network communication over websockets on port 80 to get around…
Nathan
  • 258
  • 2
  • 4
  • 10
1
vote
2 answers

How do I configure reverse proxy for WSS support on a different port?

I'm using the vaultwarden docker container, which basically requires a reverse proxy to provide SSL. The container runs a separate web server for Websockets, because Rust's rocket doesn't support web sockets on the same port. The instructions for…
John
  • 141
  • 4