无法使用 AnyCable 通过网络插座连接 Rails 和 Go



我正在尝试在需要与GO服务器通信的Rails 5.2应用程序中配置Anycable。

这是我在 Rails 中的任何电缆配置:

default: &default
rpc_host: "localhost:50051"
log_grpc: false
log_file: nil
debug: false # Shortcut to enable GRPC logging and debug level
log_level: info
redis_channel: "__anycable__" 
redis_sentinels: []

production:
  <<: *default
  redis_url: "redis://localhost:6379/1"
development:
  <<: *default
  redis_url: "redis://localhost:6379/2"

并且anycable服务器在localhost:3334(使用默认设置(中运行。但是,当我尝试从GO应用程序连接到同一服务器时,我开始从Rails端收到连接超时错误。(反之亦然,GO端超时(

我有下一个文件:

config/anycable.yml

development:
  # gRPC server host
  rpc_host: "localhost:50051"
  # Redis URL (for broadcasting)
  redis_url: "redis://localhost:6379/2"
  # You can also turn on access logging
  access_logs_disabled: false
  debug: true

我运行我的服务器:

我的文件 Procfile.dev 不是必需

web: bundle exec rails s -b 0.0.0.0 -p 3000
rpc: bundle exec ./bin/anycable
go: sleep 5 && ./cable/anycable-go-0.5.4 -addr 'host.lvh.me:8080' -disconnect_rate=1

最新更新