WebSocketBundle Symfony 4集成

时间:2018-01-22 13:58:29

标签: php symfony websocket symfony4

我遇到Symfony 4与GeniusesOfSymfony / WebSocketBundle集成的问题,pubsub的路由文件没有加载。 安装一切 'gos/web-socket-bundle dev-master ' 'gos/pubsub-router-bundle v0.3.2'

创建文件_ / config / packages / gos_web_socket.yaml_,内容

gos_web_socket:
    server:
        port: 1337        #The port the socket server will listen on
        host: 127.0.0.1   #The host ip to bind to
        router:
           resources:
               - '%kernel.project_dir%/config/pubsub.yaml'
    topics:
        - "@app.topic.chat"

并将内容'/ config / pubsub.yaml'归档

app_topic_chat:
    channel: 'app/chat/{first_user}/{second_user}'
    handler:
        callback: 'chat.topic' #related to the getName() of your topic
    requirements:
        first_user:
            pattern: '\d+' #accept all valid regex, don't put delimiters !
        second_user:
            pattern: '\d+'

始终出错

!!  In DelegatingLoader.php line 37:
!!                                                                               
!!    Cannot load resource "/var/www/html/cms/config/pubsub.yaml". 

请帮忙

1 个答案:

答案 0 :(得分:0)

呃,问题在于命名。 这是

  
      
  • '%kernel.project_dir%/配置/ pubsub.yaml'
  •   

但需要

  
      
  • '%kernel.project_dir%/配置/ pubsub.yml'
  •   

所以 yml 不是 yaml

相关问题