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

Simple TLS wrapper for IoServer #1082

Open
d47081 opened this issue Feb 11, 2025 · 0 comments
Open

Simple TLS wrapper for IoServer #1082

d47081 opened this issue Feb 11, 2025 · 0 comments

Comments

@d47081
Copy link

d47081 commented Feb 11, 2025

I want to wrap this working component into the TLS without any HTTP or WS layers:

$server = \Ratchet\Server\IoServer::factory(
    new \Yggverse\Pulsar\Controller\Server\Nex(
        $config,
        $database
    ),
    $config->get()->server->nex->port,
    $config->get()->server->nex->host
);

$server->run();

I'm trying this construction:

$loop = \React\EventLoop\Loop::get();

$server = new \Ratchet\Server\IoServer(
    new \Yggverse\Pulsar\Controller\Server\Gemini(
        $config,
        $database
    ),
    new \React\Socket\SecureServer(
        new \React\Socket\Server(
            sprintf(
                "%s:%d",
                $config->get()->server->gemini->host,
                $config->get()->server->gemini->port,
            ),
            $loop
        ),
        $loop,
        [
            'local_cert'        => $config->get()->server->gemini->local_cert,
            'local_pk'          => $config->get()->server->gemini->local_pk,
            'allow_self_signed' => $config->get()->server->gemini->allow_self_signed,
            'verify_peer'       => $config->get()->server->gemini->verify_peer
        ]
    ),
    $loop
);

$server->run();

It launching the server, call the Gemini constructor,
but the server does not respond for events like onOpen or onMessage

I suppose that forgot to add some listener.

Here is the source of working MessageComponentInterface component:
https://github.com/YGGverse/Pulsar/blob/main/src/Controller/Server/Nex.php

But this one works without TLS, where new one I'm trying to add (Gemini protocol) should use it.
How can I handle the raw input/output stream events, without using any of HTTP/WS wrappers that maybe implements this listener?

Thanks

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