Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: self signed certificate issue while implementing WSS signaling server. #1062

Open
CODEMAX666 opened this issue Jun 26, 2024 · 0 comments

Comments

@CODEMAX666
Copy link

CODEMAX666 commented Jun 26, 2024

Issue: Unable to Resolve "self signed certificate" Error in PHP WebSocket Server

Description

I am experiencing an issue with my PHP WebSocket server where I continually receive the "self signed certificate" error, despite configuring the server to allow self-signed certificates. Below are the details of my setup and the steps I have taken to try to resolve this issue.

use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use React\EventLoop\Loop;
use React\Socket\SocketServer;
use React\Socket\SecureServer;
use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;

$loop = Loop::get();
$webSock = new SocketServer('0.0.0.0:8080', [], $loop);

$secureWebSock = new SecureServer($webSock, $loop, [
    'local_cert' => 'C:\xampp\apache\conf\ssl.crt\ssl.crt',
    'local_pk' => 'C:\xampp\apache\conf\ssl.crt\ssl.key',
    'allow_self_signed' => true,
    'verify_peer' => false,
    'verify_peer_name' => false,
]);

$webServer = new IoServer(
    new HttpServer(
        new WsServer(
            new SignalingServer()
        )
    ),
    $secureWebSock,
    $loop
);

echo "Secure WebSocket server running at wss://0.0.0.0:8080\n";

$webServer->run();

I have tested with wscat.

E:\tmp>wscat -c wss://localhost:8080/check --no-check
Connected (press CTRL+C to quit)
Disconnected (code: 1000, reason: "")

E:\tmp>wscat -c wss://localhost:8080/check
error: self signed certificate

How to solve this problem?
I have also tried with default SSL keys in XAMPP, in that case, I got "error: certificate has expired" error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant