Real Time Data Configuration
You can configure real time data in two ways in Cryptomania Exchange Pro.
- Pusher (Easy setup, no hassle)
- 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-servercommand to install laravel echo server globally. - Make sure
/var/www/html/resources/assets/js/bootstrap.jsfile 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 devornpm run productiondepending 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:allto clear all cache.
Configure Laravel Echo Server in Supervisor
- Create
echo-server.confconfig file inside/etc/supervisor/conf.dthis directory. - Create
echo-server.logfile inside/var/logdirectory and give write permission. - Open
echo-server.confand 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