$serviceAccountFile = '/var/www/html/credentials.json';
$scopes = ['https://www.googleapis.com/auth/firebase.messaging'];
$credentials = new ServiceAccountCredentials(
$scopes,
$serviceAccountFile
);
$token = $credentials->fetchAuthToken();
$accessToken = $token['access_token'];
{
"message": {
"token": "eVkcH93BTwmpd06HPtuxeY:APA91bHNW6ZIAOe1IOKmpdHmiRQSnN69X_s4Duq0bYbaCt6IVDsh80KkjBNRxVoUMRUyRoHjn6HQlRrm9I5_Kj0eciorJ9rrlfUqeDJwiBcrFpV5aZeNwsRmOXPIkPeZJeHHQdKSM_ERs",
"notification": {
"title": "Breaking News",
"body": "New news story available."
},
"data": {
"story_id": "story_12345"
}
}
}
{
"error": {
"code": 400,
"message": "The registration token is not a valid FCM registration token",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
}
]
}
}
'push_sender' => [AsyncPushSender::class, 'sendMessageNewChatMessage']
$push_sender = Yii::$app->getModule('server-chat')->push_sender;
$push_sender($message, $preparedData, $title, $type, $userID);
$push_sender = Yii::$app->getModule('server-chat')->push_sender;
$push_sender($message, $preparedData, $title, $type, $userID);
class Module extends \yii\base\Module
{
public $count_workers = 2;
public $domain = '192.168.1.1';
public $host = '127.0.0.1';
public $domain_workerman = 'php';
public $port = 2346;
public $ssl = false;
public $ssl_cert = '/etc/ssl/home-call.crt';
public $ssl_pkey = '/etc/ssl/home-call.key';
public $db = 'db';
public $push_sender = null;
}
function(event) {
return _this.hide(event);
}
function handler(event) {
hydrateObj(event, {
delegateTarget: element
});
if (handler.oneOff) {
EventHandler.off(element, event.type, fn);
}
return fn.apply(element, [event]);
}
version: '3.3'
services:
php:
restart: always
build: ./
# platform: linux/arm64/v8
depends_on:
- db_mpv
- db_sppvr
ports:
- 9903:9000
volumes:
- ./:/var/www/html
- ./docker/nginx/ssl:/etc/ssl
networks:
- backend
- default
nginx:
restart: always
image: nginx:latest
# platform: linux/arm64/v8
depends_on:
- db_mpv
- db_sppvr
ports:
- "${NGINX_EXPOSE_PORT}:${NGINX_PORT}"
- "${NGINX_EXPOSE_PORT_2}:${NGINX_PORT_2}"
- "443:443"
volumes:
- ./:/var/www/html
- ${NGINX_CONF}:/etc/nginx/conf.d
- ./docker/nginx/ssl:/etc/ssl
- ./docker/nginx/logs:/var/log/nginx
db_mpv:
restart: always
image: postgres:15.0
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "postgres" ]
timeout: 45s
interval: 10s
retries: 10
ports:
- ${DB_MPV_EXPOSE_PORT}:${DB_MPV_PORT}
volumes:
- ./docker/db_mpv/data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=$DB_MPV_NAME
- POSTGRES_USER=$DB_MPV_USERNAME
- POSTGRES_PASSWORD=$DB_MPV_PASSWORD
db_sppvr:
restart: always
image: postgres:15.0
healthcheck:
test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "postgres" ]
timeout: 45s
interval: 10s
retries: 10
ports:
- ${DB_SPPVR_EXPOSE_PORT}:${DB_SPPVR_PORT}
volumes:
- ./docker/db_sppvr/data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=$DB_SPPVR_NAME
- POSTGRES_USER=$DB_SPPVR_USERNAME
- POSTGRES_PASSWORD=$DB_SPPVR_PASSWORD
supervisor:
command: [ "/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf" ]
build: ./
restart: always
depends_on:
- php
ports:
- 2347:2346
volumes:
- ./:/var/www/html
- ./docker/crontab/log:/var/log/
- ./docker/nginx/ssl:/etc/ssl
networks:
- backend
- default
networks:
backend:
driver: bridge