Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit b1615d9

Browse files
author
Luca Aquino
committed
added support for ssl chain certificate file
1 parent 593f5cf commit b1615d9

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,19 +77,20 @@ $ laravel-echo-server start
7777
Edit the default configuration of the server by adding options to your **laravel-echo-server.json** file.
7878

7979

80-
| Title | Default | Description |
81-
| :--------------- | :------------------- | :---------------------------|
82-
| `authEndpoint` | `/broadcasting/auth` | The route that authenticates private channels |
83-
| `authHost` | `http://localhost` | The host of the server that authenticates private and presence channels |
84-
| `database` | `redis` | Database used to store data that should persist, like presence channel members. Options are currently `redis` and `sqlite` |
85-
| `databaseConfig` | `{}` | Configurations for the different database drivers [Example](#database)|
86-
| `host` | `null` | The host of the socket.io server ex.`app.dev`. `null` will accept connections on any IP-address |
87-
| `port` | `6001` | The port that the socket.io server should run on |
88-
| `protocol` | `http` | either `http` or `https` |
89-
| `sslCertPath` | `''` | The path to your server's ssl certificate |
90-
| `sslKeyPath` | `''` | The path to your server's ssl key |
91-
| `sslPassphrase` | `''` | The pass phrase to use for the certificate (if applicable) |
92-
| `socketio` | `{}` | Options to pass to the socket.io instance ([available options](https://github.com/socketio/engine.io#methods-1)) |
80+
| Title | Default | Description |
81+
| :------------------| :------------------- | :---------------------------|
82+
| `authEndpoint` | `/broadcasting/auth` | The route that authenticates private channels |
83+
| `authHost` | `http://localhost` | The host of the server that authenticates private and presence channels |
84+
| `database` | `redis` | Database used to store data that should persist, like presence channel members. Options are currently `redis` and `sqlite` |
85+
| `databaseConfig` | `{}` | Configurations for the different database drivers [Example](#database)|
86+
| `host` | `null` | The host of the socket.io server ex.`app.dev`. `null` will accept connections on any IP-address |
87+
| `port` | `6001` | The port that the socket.io server should run on |
88+
| `protocol` | `http` | either `http` or `https` |
89+
| `sslCertPath` | `''` | The path to your server's ssl certificate |
90+
| `sslKeyPath` | `''` | The path to your server's ssl key |
91+
| `sslChainCertPath` | `''` | The path to your server's ssl chain certificate |
92+
| `sslPassphrase` | `''` | The pass phrase to use for the certificate (if applicable) |
93+
| `socketio` | `{}` | Options to pass to the socket.io instance ([available options](https://github.com/socketio/engine.io#methods-1)) |
9394

9495
### Running with SSL
9596

@@ -246,7 +247,7 @@ add a script tag to your html like so:
246247
247248
```
248249

249-
_Note: When using the socket.io client library from your running server, remember to check that the `io` global variable is defined before subscribing to events._
250+
_Note: When using the socket.io client library from your running server, remember to check that the `io` global variable is defined before subscribing to events._
250251

251252
#### Better performance with [µWebSockets](https://github.com/uWebSockets/uWebSockets)
252253
For extra performance, you can use the faster `uws` engine instead of `ws`, by setting the `wsEngine` option for Socket.IO in `laravel-echo-server.json`:

src/cli/cli.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ export class Cli {
9090
when: function(options) {
9191
return options.protocol == 'https';
9292
}
93+
}, {
94+
name: 'sslChainCertPath',
95+
message: 'Enter the path to your SSL chain certificate file.',
96+
when: function(options) {
97+
return options.protocol == 'https';
98+
}
9399
}, {
94100
name: 'sslKeyPath',
95101
message: 'Enter the path to your SSL key file.',

src/echo-server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class EchoServer {
3333
socketio: {},
3434
sslCertPath: '',
3535
sslKeyPath: '',
36+
sslChainCertPath: '',
3637
sslPassphrase: ''
3738
};
3839

src/server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export class Server {
7373
Object.assign(this.options, {
7474
cert: fs.readFileSync(this.options.sslCertPath),
7575
key: fs.readFileSync(this.options.sslKeyPath),
76+
ca: (this.options.sslChainCertPath) ? fs.readFileSync(this.options.sslChainCertPath) : '',
7677
passphrase: this.options.sslPassphrase,
7778
});
7879

0 commit comments

Comments
 (0)