Browse Source

added final questions

added ssl certificate and switched from http & ws to https &wss
files to exchange for you are server/cert.pm for the certificate and server/key.pem for the key of the Hochschul certifiacte
master
Niko 5 years ago
parent
commit
e73bcc134b
5 changed files with 59 additions and 3 deletions
  1. 1
    1
      .vscode/launch.json
  2. 1
    1
      client/ws-client.js
  3. 23
    0
      server/cert.pem
  4. 27
    0
      server/key.pem
  5. 7
    1
      server/ws-server.js

+ 1
- 1
.vscode/launch.json View File

"type": "chrome", "type": "chrome",
"request": "launch", "request": "launch",
"name": "Launch Chrome", "name": "Launch Chrome",
"url": "http://localhost:8000",
"url": "https://localhost:8000",
"webRoot": "${workspaceFolder}/client" "webRoot": "${workspaceFolder}/client"
}, },



+ 1
- 1
client/ws-client.js View File

// #endregion // #endregion


// websocket to communicate with the server // websocket to communicate with the server
var ws = new WebSocket('ws://' + window.location.host + window.location.pathname + 'ws');
var ws = new WebSocket('wss://' + window.location.host + window.location.pathname + 'ws');


// #region speech recognition initialization // #region speech recognition initialization
var recognition = new SpeechRecognition(); var recognition = new SpeechRecognition();

+ 23
- 0
server/cert.pem View File

-----BEGIN CERTIFICATE-----
MIID1zCCAr8CFFQdsOqUqVpXkNcENXj66TeS6crHMA0GCSqGSIb3DQEBCwUAMIGn
MQswCQYDVQQGEwJERTEQMA4GA1UECAwHQkFWQVJJQTESMBAGA1UEBwwJTlVSRU1C
RVJHMQwwCgYDVQQKDANPSE0xDjAMBgNVBAsMBURFTUJBMTMwMQYDVQQDDCpodHRw
czovL21lZGluZi5lZmkudGgtbnVlcm5iZXJnLmRlL2RlbWVuei8xHzAdBgkqhkiG
9w0BCQEWEG5pa29fYmVsZUBnbXguZGUwHhcNMTkwOTA1MTQ0MjMzWhcNNDcwMTIw
MTQ0MjMzWjCBpzELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0JBVkFSSUExEjAQBgNV
BAcMCU5VUkVNQkVSRzEMMAoGA1UECgwDT0hNMQ4wDAYDVQQLDAVERU1CQTEzMDEG
A1UEAwwqaH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W3Z
eciOkfKExZLsSeGZJfVt8QKBgFhkR4YHIfZLfadPAU7R0Dnribzfauk1REfN8yNz
nfR+8fb+Eepb+uJ+VlTAS72n3P3EpR7RRw2y3fLTkVaqhnzacAxEpeBAHXEGe3ER
HFDCdlvLHjnD4wycxwzpAQCcDij7qQpgi9iHTpv8i7mJE/K/3K+VhqS9+F3uHaRb
wAcBAoGAe58kt4AHnHa67MutpTSBiM9CFqzOOJnp1HcU3eRlVgqoe8okZeaqTSQW
hyte4cpsMLlfiVFU+xxzzSCRDAksmEewdy1/cEovdEEKeBn2UDFpVe9pix73jxnU
roPAtn8PPB7VWRpClVpkOefMM+1mj5U+xdq/mM+LNPQvALENsbE=
-----END RSA PRIVATE KEY-----

+ 7
- 1
server/ws-server.js View File



// server and websocket // server and websocket
const WebSocket = require('ws'); const WebSocket = require('ws');
var fs = require('fs');
const http = require('http'); const http = require('http');
const https = require('https');
const path = require('path'); const path = require('path');
const express = require('express'); const express = require('express');




app.use('/', router); app.use('/', router);


var server = http.createServer(app);
// var server = http.createServer(app);
var server = https.createServer({
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
}, app);


server.listen(process.env.port || webSocketsServerPort, function () { server.listen(process.env.port || webSocketsServerPort, function () {
console.log((new Date()) + ' Server is listening on port ' + console.log((new Date()) + ' Server is listening on port ' +

Loading…
Cancel
Save