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

Server running but nothing is displayed #15

Open
ace411 opened this issue Oct 9, 2017 · 0 comments
Open

Server running but nothing is displayed #15

ace411 opened this issue Oct 9, 2017 · 0 comments

Comments

@ace411
Copy link

ace411 commented Oct 9, 2017

Hello,

I've attempted to use your package to set up a simple server to print a message, hello. I have failed to get any output on the console or in the browser. My code appears as follows:

$server = new Rx\Websocket\Server('127.0.0.1:8020');

$server->subscribe(
    function (Rx\Websocket\MessageSubject $subject) {
        $subject->subscribe(
            function ($message) {
                echo $message . PHP_EOL;
            }
        );

        $sayHello = function () use ($subject) {
            $subject->onNext('Hello');
        };

        $sayHello();

        \EventLoop\addPeriodicTimer(5, $sayHello);
    },
    function ($error) {
        echo "Connection Error";
    },
    function () {
        echo "Completed";
    }
);

I do however get a 500 server 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