You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can manually set up Nymph PubSub if you don't want to use the app template. Once you've followed the instructions for setting up a Nymph server, you're ready to set up a PubSub server.
Setting up a Nymph PubSub server is very similar to setting up the REST endpoint. One key difference is that you must run the PHP file you create in order to run the server. Nymph PubSub does not use your web server to accept connections. It opens its own port to accept WebSocket connections.
Create a file which you will run to launch your PubSub server. In the nymph-examples repo, it is named pubsub.php. Add anything you need to configure Nymph.
Before you start setting everything up, you should make sure the file was called from the command line.
if (php_sapi_name() != "cli") {
die("You can only run pubsub.php from the command line.");
}
The first step is to create your config array. You can see the available configuration options in the PubSub defaults file.
$config = [
'port' => 8080
];
Make sure Nymph is connected, and load all of the classes you'll need (unless you're using an autoloader).