Skip to content

Real Time Data Configuration

You can configure real time data in two ways in Cryptomania Exchange Pro.

  1. Pusher (Easy setup, no hassle)
  2. Laravel Echo Server

Pusher Configuration

Please go to https://dashboard.pusher.com/accounts/sign_up and open an account if you don’t have any. After logging in your account please create a new app for your exchange. Once creation is done you will be redirect to a page where app keys tab will have all the credential you need. Copy them and paste them under the related keys in .env file. check the setting here. You will get the following keys there.

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER= 

Open /var/www/html/resources/assets/js/bootstrap.js file and replace line 9 to 16 with bellow code

window.Pusher = require('pusher-js');
window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    encrypted: false
});

After changing any configuration run following commands:

npm run production //'npm run dev' for development
php artisan clear:all
php artisan horizon:terminate

Laravel Echo Server Configuration

  • Run npm install -g laravel-echo-server command to install laravel echo server globally.
  • Make sure /var/www/html/resources/assets/js/bootstrap.js file line 9 to 16 has the following code
window.io = require('socket.io-client');
window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: window.location.hostname + ':6001'
});
  • After installing run npm run dev or npm run production depending on your environment.
  • Open laravel-echo-server.json file and modify the following variables
"authHost" : "http://your_site_url",
"port" : "6001", 
"protocol" : "http",

If use https then you need to change protocol to https and add your ssl certificate and private key absolute path. If you don't upload these file into server then upload it first.

"sslCertPath": "ssl.cert",
"sslKeyPath": "ssl.key",
  • Run php artisan clear:all to clear all cache.

Configure Laravel Echo Server in Supervisor

  1. Create echo-server.conf config file inside /etc/supervisor/conf.d this directory.
  2. Create echo-server.log file inside /var/log directory and give write permission.
  3. Open echo-server.conf and paste the following configuration and save.
[program:echo-server]
process_name=%(program_name)s
command=laravel-echo-server start --dir=/var/www/html/
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/log/echo-server.log

Starting Laravel Echo Server

Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands:

sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start echo-server

You need to run the following command to check if your supervisor is running successfully.

sudo supervisorctl status