Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/doc/node-ws/examples/ drwxr-xr-x |
Viewing file: Select action/file-type: 'use strict'; const https = require('https'); const fs = require('fs'); const WebSocket = require('..'); const server = https.createServer({ cert: fs.readFileSync('../test/fixtures/certificate.pem'), key: fs.readFileSync('../test/fixtures/key.pem') }); const wss = new WebSocket.Server({ server }); wss.on('connection', function connection(ws) { ws.on('message', function message(msg) { console.log(msg.toString()); }); }); server.listen(function listening() { // // If the `rejectUnauthorized` option is not `false`, the server certificate // is verified against a list of well-known CAs. An 'error' event is emitted // if verification fails. // // The certificate used in this example is self-signed so `rejectUnauthorized` // is set to `false`. // const ws = new WebSocket(`wss://localhost:${server.address().port}`, { rejectUnauthorized: false }); ws.on('open', function open() { ws.send('All glory to WebSockets!'); }); }); |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0045 ]-- |