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

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
  • 663
  • 3
  • 11
  • 29
0
votes
1 answer

Keep connections of closed instances behind a load balancer

I'm looking for a system to create a live sockets application through sockets.io and that can be balanced without problem. There are tons of solutions to balance the load between multiple socket instances, like SocketCluster, but the problem I'm…
0
votes
2 answers

How can I secure an insecure Meteor by using Nginx?

I have an insecure Meteor running on AWS. For those not familiar with Meteor, that means I am using the "insecure" package, which trades security for rapid prototyping. I only need our development team and stakeholders to access the server. In the…
Ruby
  • 139
  • 1
  • 1
  • 3
0
votes
1 answer

docker container port forwarding behavior for `run` command (for websockets)

I am running an ipython notebook server inside a docker container. Running code inside the notebook from the browser works over websockets, which have to connect from outside the container (a browser) to the tornado server running inside. I noticed…
user1248490
  • 103
  • 3
0
votes
0 answers

mod_proxy_wstunnel Status line does not end with CRLF

I'm using Apache 2.4.9 with mod_proxy_wstunnel and Proxy balancer to load balance between two websocket servers. I have a Spring Websocket Server to which my client is able to connect without any issues. The moment I add Apache web server with…
0
votes
1 answer

Nginx does not stop with websocket connection

I have nginx 1.6.2 wih configuration to upgrade connection to websocket. proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; When no websocket connection is opened, "service nginx stop" works, both master and worker…
Bastien974
  • 1,896
  • 12
  • 44
  • 62
0
votes
0 answers

Does reverse proxying the WebSockets servers make sense from scaling perspective?

I have reverse proxy and multiple WebSocket servers behind it. I'm confused whether it makes any sense from scaling perspective, because I see it like that: The WebSocket server A has 30_000 active connections The WebSocket server B has 20_000…
Szyszka947
  • 111
  • 3
0
votes
0 answers

Forward local generated Secure Websocket traffic (wss) through an HTTP/HTTPS proxy to reach internet

I have a python webex_bot application (https://github.com/fbradyirl/webex_bot) which uses websockets for webex cloud communication. The problem is that the server in which the bot is being hosted on, does not have direct reachability to the…
panchis
  • 1
  • 1
0
votes
0 answers

nginx logging (111: connection refused) when connecting to a websocket

So I have a small Raspberry Pi on my local network that I use to host a server. It is a fairly simple setup, with nginx and my npm-hosted server stood up in containers using docker-compose. my npm server listens to port 30000. Here is my nginx…
Flotolk
  • 101
  • 2
0
votes
0 answers

Apache websocket and web app in the same directory structure

I have a web app running in LAMP server now I want to have some features transferred to web socket without changing the directory structure which means the root directory of the web app should be secure HTTP and the "websock" directory under the…
Engin Yilmaz
  • 111
  • 3
0
votes
1 answer

Access errors passing traffic from nginx to daphne server

I've got a GKE private k8s cluster with nginx and a django application running with wsgi and asgi. Logs from nginx show that websocket requests get a 403, and the logs on the daphne pod are showing "access denied" type errors. I've also got a…
markwalker_
  • 141
  • 1
  • 2
  • 12