我正在尝试将laravel-websockets部署到谷歌应用程序引擎服务中,而不是管理ssl证书。应用程序引擎“谷歌前端”将只转发端口80和443到在端口8080监听的自定义用户nginx.conf文件。因此,部署后没有错误,google stackdriver日志显示websocket服务正在接受连接,但前端服务没有显示任何内容,没有错误,也没有成功。那么我错过了什么?
此服务的当前nginx.conf为:
daemon off;
user root;
worker_processes auto;
error_log /dev/stderr info;
events {
worker_connections 4096;
}
http {
access_log /dev/stdout;
server {
listen 8080;
location / {
proxy_pass http://127.0.0.1:6001;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}和我的app.yaml文件:
runtime: custom
env: flex
service: websockets
manual_scaling:
instances: 1
resources:
cpu: 2
memory_gb: 2
disk_size_gb: 10
runtime_config:
document_root: public
enable_stackdriver_integration: true
readiness_check:
app_start_timeout_sec: 1800
env_variables:
// all basic laravel env here plus:
BROADCAST_DRIVER: pusher
PUSHER_APP_ID: testing
PUSHER_APP_KEY: testing
PUSHER_APP_SECRET: testing我在broadcast.php文件中的推送器配置是
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'host' => 'my-websockets-service-generated-domain.appspot.com',
'port' => '443',
'scheme' => 'https',
'encrypted' => true
],
],最后是我在客户端的设置:
window.Pusher = require('pusher-js')
const echo = new Echo({
authEndpoint: 'my-backend-service-generated-domain.appspot.com/broadcasting/auth',
broadcaster: 'pusher',
key: 'testing',
httpHost: 'my-websockets-service-generated-domain.appspot.com',
httpsPort: 443,
disableStats: true,
encrypted: true
})google堆栈驱动程序记录:

发布于 2019-04-24 17:33:55
我有个主意!在客户端的Echo设置中,我需要使用wsHost,并将wsPort和wssPort更新为使用80和443,nginx反向代理将其代理到6001
broadcaster: 'pusher',
key: 'testing',
wsHost: 'my-websockets-service-generated-domain.appspot.com',
wsPort: 80,
wssPort: 443,
disableStats: true,
encrypted: truehttps://stackoverflow.com/questions/55814533
复制相似问题