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

How can do Load Test against WebSocket?

We will have to do a load test for the first time. To tell the truth, I don't know exactly what to look for and how to do it. I have also researched resources on this subject but I could not obtain enough information on the internet and I wanted to…
eddiethedean
  • 11
  • 1
  • 2
1
vote
0 answers

Channels current state is disconnected(laravel-websocket on ubuntu Host server)

I am working on Laravel-websocket package i got stucked on this error from quite long time. i have configure basic laravel procject along with laravel websocket package on my local ubuntu as well as digitalocen ubuntu host server.I did same…
Gopi
  • 11
  • 2
1
vote
0 answers

Apache reverse proxy to websocket in same context as http

I have an Apache/2.4.6 installation working as a reverse proxy for some applications. Now I have to configure another one. HTTP proxying is working great, but in some sections of the webpage, the client tries to start a websocket connection. The…
Mike B
  • 370
  • 2
  • 5
  • 21
0
votes
1 answer

Ejabberd MUC room not sending unavailable presence for disconnected users

I'm running ejabberd 19.09.1 using the official Docker image, configured for anonymous authentication with mod_muc. Clients generally connect to the server in the browser, through a WebSocket endpoint. ejabberd is sitting behind an nginx reverse…
0
votes
1 answer

Cannot establish Websocket on AWS

I have a webserver running on an EC2 instance behind an AWS load balancer under a custom domain for using https. Curl requests to the webserver work as expected, including over https. But establishing a websocket connection fails with the following…
0
votes
1 answer

TCPDUMP, tcp Flag not changing from Flags [S] to other flag values

I need support understanding these lines. when i tried to connect to server in a particular port it shows connecting and gives me timeout error. But in the tcp-dump command the packet flag not changing from [s] to other flags. Review the below log…
VinothRaja
  • 101
  • 3
0
votes
1 answer

What is the fastest posible way to comunicate to a server on Amazon EC2?

I need to communicate via WebSockes and normal HTTP. I am trying to save some microseconds. I have already done: I got an instance at the same Amazon EC2 zone. The ping is 1 millisecond. I have translated the application from Perl to Julia. It is a…
0
votes
0 answers

How to distribute socket.io servers globally?

We have a Socket.io service that needs constant communication with Mongodb. We currently have a load balancer server, 16 containers in a server (due to nodejs being single threaded, we split processes by dockers so we can utilize entire server) and…
Ümit Yayla
  • 11
  • 1
  • 4
0
votes
0 answers

Cannot connect to websocket

When I tried to connect to spring boot web socket from android stomp client, it is not connecting and the catalina log shows Handshake failed due to invalid Upgrade header: null Tomcat server is running behind apache and the apache server runs on…
Sony
  • 103
  • 1
  • 7
0
votes
1 answer

Azure WebApp Socket can't connect

I have a ASP .NET application hosted as a WebApp in Azure and a Xamarin client app that consumes that WebApi in Azure. As soon as I changed my webapi to an Azure WebApp, which was previously hosted in non-azure VM and it was working fine, my Xamarin…
0
votes
1 answer

Redirect websocket and json in SSL with NGINX

I'm getting crazy to solve a problem with the neginx configuration of a live blogging platform. In http it works, and here is the configuration: /etc/nginx/conf.d/default.conf server { listen 80 default; include…
Roberto Pezzali
  • 141
  • 1
  • 1
  • 9
0
votes
1 answer

Nginx websoket reverse proxy caching

I'm currently using nginx to reverse proxy a websocket based application. Can I enable caching websocket messages to make the application available when service behind is down? I know caching is possible for HTTP requests as documented here. Is…
TRiNE
  • 103
  • 3
0
votes
1 answer

Nginx + Socket.io + Proxy

After reading several articles, I'm still unable to get my socket.io communication working via a nginx proxy. Below is my nginx configuration: map $http_upgrade $connection_upgrade { default upgrade; '' close; } location ~* \.io { …
0
votes
1 answer

Nginx: How to log the number of bytes sent over a websocket?

I am using nginx as a websocket reverse-proxy. I would like to log the number of bytes sent (and ideally also received) over a websocket. If I use $body_bytes_sent in log_format, the entry in the access_log is always 0. As far as I can tell, a lot…
seeker6
  • 1
  • 4
0
votes
1 answer

High CPU load in a data aquisition server

I`ve setup a small python program that uses a websocket connection to acquire data from an API and write it to a postgresql database. There are only two (user) programs running: the websocket connection that receives data and write it to the…
Alex
  • 121
  • 2