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

Cannot SOCKET_PUSH from browser, although everything working fine from command line #197

Open
tafelnl opened this issue Dec 20, 2018 · 1 comment

Comments

@tafelnl
Copy link

tafelnl commented Dec 20, 2018

I have the following code:

socket.php:

$loop   = React\EventLoop\Factory::create();
$pusher = new \Pusher;

$context = new React\ZMQ\Context($loop);
$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://0.0.0.0:5555');
$pull->on('message', array($pusher, 'someFunction'));

//following code made possible by Ratchet
//URL: http://socketo.me/docs/push#tying_it_together
$webSock = new React\Socket\Server('0.0.0.0:8080', $loop);
$webServer = new Ratchet\Server\IoServer(
    new Ratchet\Http\HttpServer(
        new Ratchet\WebSocket\WsServer(
            new Ratchet\Wamp\WampServer(
                $pusher
            )
        )
    ),
    $webSock
);

$loop->run();

pusher.php:

$context = new ZMQContext();

$socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
$socket->connect("tcp://mydomain.com:5555");

$socket->send('someString);

Both work fine from the command line, and I can also actually send out and receive data.

But whenever I try to execute the pusher.php from the browser (something that has to work in the production version eventually) nothing happens.

Does anyone know what may be causing this? All ports etc are opened up as far as I know.

@md-riaz
Copy link

md-riaz commented Nov 23, 2023

I also stuck in the same situation.

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

2 participants