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

Proxy pass to express http server not working with secure websocket

So I currently have apache with a proxy pass which redirects all requests to an express api running using the http node module, I also have a letsencrypt ssl certificate installed and all is working fine on this part. However, When I try to open a…
Finbar
  • 101
  • 1
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

why litespeed prevent reverse proxy working?

when my server running with litespeed the ProxyPass to external site (e.g. google.com) not working but on apache it works litespeed says that you must add a web server in externalApp in litespeed configuration panel so far all is ok but i want to…
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
  • 380
  • 2
  • 11
0
votes
0 answers

How can we deploy the substrate blockchain framework?

I am new to networking and would like to make my substrate-based blockchain available to the public. Indeed, it is always running on local by default but I do not know how to expose that local address. So it says listening for new connections on…
0
votes
0 answers

PHP Websocket in a SSL-enabled website served by apache

I have the following WebSocket code in PHP, which works well when connecting to it by using plain-text ws:// but when I try to connect to it from a front-end Javascript in my SSL-enabled website I get the "mixed content error". I am trying to find a…
CDoc
  • 101
  • 3
0
votes
0 answers

Nginx websocket reverse proxy remove location

Trying to set up an nginx https reverse proxy to home assistant, this works: ... location / { proxy_pass http://127.0.0.1:8123; proxy_redirect http:// https://; proxy_http_version 1.1; proxy_set_header Upgrade…
jayjay
  • 101
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
0 answers

Nginx revere proxy Websocket error 404

i'm working with two Nginx one behind the each other. Our Infraestructure it's like this infraestructure Problem I've problems with websocket connections, when i send the request to Nginx Proxy pass always return 404 but when i send the request to…
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
  • 5
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
  • 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…
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
  • 99
  • 1
  • 14
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
  • 243
  • 1
  • 5
  • 16