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
1 answer

kubernetes pod with a socket connection not firing 'close' event

I have a Kubernetes deployment where a pod connects to a client via TCP Socket. On connect and disconnect different events happen. In the dev environment the server can respond to connections, data, and end, but in the production environment it only…
0
votes
1 answer

Loadbalancing websockets with nginx behind haproxy

I have an Nginx instance which serves requests proxied to it from an haproxy. This instance should balance load between several websocket server. To get better performance the load balancing should be sticky and so i used ip_hash as the load…
mhk
  • 101
  • 3
0
votes
1 answer

What happens to existing HTTP and Websocket connections when the NGINX configuration reloads?

Let’s say we have a pretty standard blue/green deployment setup. NGINX is currently proxying all traffic to the live server (BLUE). We then deploy an updated version of our code to the idle server (GREEN). Finally, we refresh the NGINX configuration…
0
votes
1 answer

Can't establish wss connection [React + ASP.NET Core, SignalR + nginx]

I have React app that talks to Asp.Net core API. Both of them are deployed on Docker on my VM. Nginx is installed and configured to resolve domain names for app (thesis.uno - for react app, api.thesis.uno - for asp.net core api) I added chat support…
0
votes
0 answers

NodeJS Unable to connect to Websocket Cross origin - "Err 1006"

I have a two webservers both running https with the same certificates, I have a main shard that the user connects to example.com, they retrieve some data and try to connect to an ip address on the 2nd shard via websocket. But no matter what I…
fmac
  • 1
  • 2
0
votes
0 answers

How to set websocket reverse proxy with both proxy_set_header and SSL allowed?

I get a project where the outer websocket reverse-proxy is implemented by nginx stream. However, steam only means "TCP" and it lost http features like writing the IP's alone the route. Here is the config of the outer layer in encrypted SSL: stream{…
George Y
  • 528
  • 6
  • 16
0
votes
1 answer

"Bad Request" when sending request to Socket.IO app via Apache

What I have I have Socket.IO app letteraly from template const express = require('express'); const app = express(); const http = require('http'); const server = http.createServer(app); const { Server } = require("socket.io"); const io = new…
RoyalGoose
  • 103
  • 5
0
votes
1 answer

Secure websocket connection to server running on EC2 fails

I have a node.js websocket server running on an EC2 instance on port 8080. Normal websocket connections (ws://) work fine but when I'm trying to make a secure connection (wss://), the websocket connection fails. I realise that wss requests are sent…
0
votes
1 answer

What are the scalability concerns with pub/sub servers?

I'm looking into setting up a pub/sub service with websockets. From what I can tell the scalability bottlenecks will mainly be with memory, which affects how many sockets can be opened at a time, so therefore I would think it wise to split this off…
JBaczuk
  • 111
  • 6
0
votes
0 answers

WebSocket connection to 'wss://[host]/' failed

Environment First of all, I'm using AWS ALB, EC2 with Route 53. ALB is opened for HTTP, HTTPS and EC2 is also opened for All TCP. And I'm using ws library to use websocket. As an HTTPS server In the EC2 instance, when I run an HTTPS server which…
Yonggoo Noh
  • 101
  • 1
  • 3
0
votes
0 answers

how to set up websocket server along with two laravel backend and a spa

i have two laravel backend setup on different routes. and there is a spa on root. now i want to set a websocket server along with it. here is my website.conf ############## block-4 : multiple subdirectory testing ############ server { listen…
rajeshtva
  • 101
  • 2
0
votes
0 answers

Clients who block all outgoing udp connections having problems connecting to turnserver

We recently had a problem with our turnserver (coturn), some clients who use firewalls to block all outgoing udp connections have problems connecting to it, as far as i know, when udp connection doesn't work, it should fallback to using tcp right ?…
logax
  • 129
  • 3
  • 14
0
votes
1 answer

Apache WebSockets "400 proxy error"

We're trying to present the WebSocket-enabled interface from a remote device on our website. I've configured the WebSocket tunnel in Apache, but I'm getting a "400 Proxy Error" in Firefox (in Chrome: "Websocket connection to ... failed"), and the…
Roger Dueck
  • 131
  • 5
  • 17
0
votes
0 answers

Websocket connection delay from Mobile App to Ubuntu 16

I've customers with Android mobiles with my app which forwards selective SMS to a Nodejs based Websocket server on Ubuntu 16. I've two set of customers and another similar Ubuntu 14 with similar app and Nodejs server. It has been working fine…
user5858
  • 263
  • 1
  • 5
  • 17
0
votes
0 answers

How to limit the total volumn from a TCP connection

I have a particular application with one type of connection that mostly sends packets to clients while receives nothing but login request. (i.e. video streaming) Therefore I want to limit the Total Volumn Received from a TCP connection (websocket…
George Y
  • 528
  • 6
  • 16