parameters:
    # the time in milliseconds determines how often a ping service being called
    # set 0 or false to disable pinging
    oro_wamp.ping.interval: 60000 # 1 minute
    # the time in milliseconds determines how often a ping service being called
    # set 0 or false to disable pinging
    oro_wamp.client_ping.interval: 45000 # 45 seconds

    oro_wamp.publisher.class:             Oro\Bundle\SyncBundle\Wamp\TopicPublisher
    oro_wamp.twig.class:                  Oro\Bundle\SyncBundle\Twig\OroSyncExtension
    oro_wamp.listener.maintenance.class:  Oro\Bundle\SyncBundle\EventListener\MaintenanceListener

services:
    oro_wamp.publisher:
        class: %oro_wamp.publisher.class%
        arguments:
            - "%websocket_backend_host%"
            - "%websocket_backend_port%"

    # this service is used as a workaround for "2006 MySQL server has gone away" error
    # do not rename it because "oro_wamp.ping.{session_handler_type}" naming convention
    # is used by ClankSessionHandlerConfigurationPass to add it to a list of periodic services
    # in case if PdoSessionHandler is configured as a session storage handler
    oro_wamp.ping.pdo:
        class: Oro\Bundle\SyncBundle\Wamp\DbPing
        arguments:
            - "@?doctrine.dbal.session_connection.wrapped"

    # this service is used to broadcast messages to clients to prevent connection loose
    # by default, the connection could be closed if no data were transmitted between client and server
    # for more details see http://nginx.org/en/docs/http/websocket.html
    oro_wamp.client.ping:
        class: Oro\Bundle\SyncBundle\Wamp\ClientPing
        arguments:
            - "@oro_wamp.publisher"
            - "@logger"

    oro_wamp.twig.sync_extension:
        class: %oro_wamp.twig.class%
        arguments:
            - "@oro_wamp.publisher"
        tags:
            - { name: twig.extension }

    kernel.listener.maintenance.event:
        class: %oro_wamp.listener.maintenance.class%
        arguments:
            - "@oro_wamp.publisher"
            - "@oro_security.security_facade"
            - "@logger"
        tags:
            - { name: kernel.event_listener, event: maintenance.on, method: onModeOn }
            - { name: kernel.event_listener, event: maintenance.off, method: onModeOff }
