Properly support SSL and non-SSL

This commit is contained in:
Alex Hultman 2019-01-08 22:04:56 +01:00
parent ba90a20e0f
commit 31278c13f3
3 changed files with 104 additions and 50 deletions

View file

@ -5,18 +5,19 @@ const port = 9001;
// nice milestone to pass autobahn on both ssl and non-ssl with an without compression
const app = uWS./*SSL*/App({
const app = uWS.SSLApp({
key_file_name: '/home/alexhultman/key.pem',
cert_file_name: '/home/alexhultman/cert.pem',
passphrase: '1234'
}).get('/hello', (res, req) => {
res.end('Hejdå!');
}).ws('/*', {
maxPayloadLength: 16 * 1024 * 1024,
open: (ws, req) => {
console.log(ws);
},
message: (ws, message, opCode) => {
ws.send(message, opCode); // need op to pass autobahn (guess binary on off is enough?)
message: (ws, message, isBinary) => {
ws.send(message, isBinary);
}
}).listen(port, (token) => {
if (token) {