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

No protocol handler was valid for the URL /url. If you are using a DSO version of mod_proxy

Trying to set up a load balancer using Apache 2.4.x on Windows. Error: No protocol handler was valid for the URL /path/. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using…
0
votes
0 answers

nginx reverse proxies with separate SSL termination and websockets

I'm trying to chain proxies. The first one for SSL, next one - for dispatching to the servers. The first one (secure-gateway-nginx) just unwraps SSL and passes to the gateway-nginx: server { listen 443 ssl; server_name secure-gateway-nginx; …
Velkan
  • 344
  • 3
  • 19
0
votes
0 answers

websocketserver behind nginx and apache

How is it possible to establish a websocket connection through nginx and apache, where both act as reverse proxies. The system is setup with apache on the main host and a tornado webapplication in a container. My apache config d is as…
eatdas
  • 1
  • 1
0
votes
1 answer

Unable to init NodeJS-based WebSocket Server as Service on Windows Server 2012

A basic node.js Implementation of a websocket server runs fine as when started via the command line or the scheduled task manager. However, after being installed as a service using nssm, it refuses to launch with the following exception: windows…
0
votes
0 answers

can many users on 1 wifi network cause issues with websockets?

We have a product that allows a group of people watching a presentation to vote on questions in the presentation on their mobile. The new version of the website that people use to vote uses websockets, for example to get notifications if a vote has…
Flion
  • 181
  • 1
  • 1
  • 8
0
votes
0 answers

elb ssl termination for wss websocket fails net::ERR_RESPONSE_HEADERS_TRUNCATED

I am trying to get a websocket communication working through a classic ELB with ssl termination to wowza, a java based media server. Setup VPC R53 test.myTld.com IPv4, Alias=Yes, Target myElb, Routing Simple CLASSIC ELB: myElb listeners: SSL…
art vanderlay
  • 171
  • 1
  • 3
0
votes
1 answer

Apache2: Is Proxy from https to http secure

Im pretty new at all this server stuff, and I have a question regarding the security of the apache proxy. What I am doing is: I have a websocket server running in non secure mode on port 11221 on the same system (localhost only, but with apache,…
Felix
  • 103
  • 2
0
votes
1 answer

Cannot connect to server via wss

I have the below nginx.conf file set to handle http and https. I'm currently using a self-signed certificate to test over ssl. server { listen 80; listen 443 ssl; server_name localhost; ssl_certificate…
Kannaj
  • 153
  • 1
  • 1
  • 7
0
votes
0 answers

Nginx, Way to re-balance websocket for a server which gets alive after failed?

I want to balance web-socket with Nginx. When it connects first, it balances the connections. When a server among upstream is failed, it also does re-balance web-socket connections. However, even when the server is recovered, Nginx still retain the…
asleea
  • 159
  • 1
  • 1
  • 8
0
votes
1 answer

PHP websocket script running as daemon stops working after a while

I start my websocket script like so: nohup php server.php & and I close the ssh client and it seems to be working fine for a while, but after say half an hour or so it stops working, any idea why and how to make it permanent?
0
votes
1 answer

How to run a Parse Live Query Server (Web Sockets) behind an AWS Load Balancer?

ParseLiveQuery depends on Websockets. More generically this question could be about getting web sockets to work behind an AWS ELB. I'm using the new Parse Server configured in AWS using Elastic Beanstalk (EB). EB configures an EC2 instance behind a…
0
votes
0 answers

Why my websockets application deployed on tomcat is not getting the shibboleth headers?

My stack looks like this: Apache httpd server 2.4.12: with mod_shibd, mod_proxy_http & mod_proxy_wstunnel Shibboleth 2.5 Apache Tomcat 7.0.54 Our scenario looks like this: --------- -------------- --------------- |Browser|…
Gaucho
  • 101
  • 2
0
votes
1 answer

Tomcat 7 WebSocket (JSR356) Examples error: WebSocket connection closed

I'm trying to setup Tomcat7 on Ubuntu 14.04 and run into the following issue: WebSocket (JSR356) Examples load but give the error: Info: WebSocket connection closed. - for everything. WebSocket Examples using the deprecated Apache Tomcat…
Tommy Burazin
  • 53
  • 1
  • 6
0
votes
1 answer

SIP.js connection to Asterisk 11.20 over WSS not working

I have successfully setup sip.js using a standard non secure ws:// to an asterisk 11 server using firefox 43. I can make and receive calls to another ff browser/hardphone. But this does not work with the latest chrome, chrome 47. i couldn't get any…
bobby
  • 11
  • 1
  • 2
0
votes
1 answer

Reverse proxy requests based on http:// or ws:// in request header

From a previously asked question I know that I can route requests to a different servers with reverse proxy, such as mod_proxy for apache. My question is, before I dig deeper into its setup, which of the reverse proxy's will allow me make a route…
Maxim V. Pavlov
  • 653
  • 2
  • 11
  • 29