Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afshinm/websocket_tls_docker
Docker image of Websocket server, Nginx as reverse proxy over TLS
https://github.com/afshinm/websocket_tls_docker
docker docker-compose nodejs tls websocket
Last synced: 3 months ago
JSON representation
Docker image of Websocket server, Nginx as reverse proxy over TLS
- Host: GitHub
- URL: https://github.com/afshinm/websocket_tls_docker
- Owner: afshinm
- License: unlicense
- Created: 2017-08-22T08:47:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-23T12:07:20.000Z (over 7 years ago)
- Last Synced: 2024-05-02T01:20:23.608Z (10 months ago)
- Topics: docker, docker-compose, nodejs, tls, websocket
- Homepage:
- Size: 2.93 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example of Websocket over TLS with Nginx
Docker image of Websocket server, Nginx as reverse proxy + TLS
## Requirements
You need to have the latest version of Docker installed (+ docker-compose).
## Setup
### Step 1
The first step is adding `ws.example.com` to your `/etc/hosts` and point it to `127.0.0.1` (or your Docker host IP, if it's not your local machine)
We will use this fake domain to send the requests on a local machine.
### Step 2
If you to test it on your local machine, you need to create a self-signed SSL certificate.
Here is a example of how to generate a self-signed certificate: https://gist.github.com/jessedearing/2351836
Please note that you have to generate the certificate for `ws.example.com`. After generating the certificates, save them to `./cert` with this convention: `ws.example.com.key` and `ws.example.com.cert`.
## Run
Go to the root directory and run:
```
docker-compose up --build
```Then, you should be able to see the traditional ping-pong message between client and the server in your terminal, like so:
```
ws.client | starting connection to ws...
ws.client | connection opened.
ws.example.com | server received a new connection
ws.client | client received: pong
ws.example.com | server received: ping
ws.client | client received: pong
ws.example.com | server received: ping
ws.client | client received: pong
ws.example.com | server received: ping
ws.client | client received: pong
```This connection is _kinda_ secure (it connects to `wss://ws.example.com`)
## License
Unlicensed.