[Solved] Websocket communication in a symfony project [closed]


In the past I tried to use the Wrench library, which has a Symfony bundle :

https://github.com/varspool/WebsocketBundle

This is a wrapper for the Wrench library, which allows you to create websocket applications.

It seems to be quite simple to configure :

# app/config/config.yml
varspool_websocket:
    servers:
        default: # Server name
            listen: ws://192.168.1.103:8000 # default: ws://localhost:8000

            # Applications this server will allow
            applications:
                - echo
                - multiplex

            # Origin control
            check_origin: true
            allow_origin: # default: just localhost (not useful!)
                - "example.com"
                - "development.localdomain"

            # Other defaults
            max_clients:             30
            max_connections_per_ip:  5
            max_requests_per_minute: 50

Then you declare your WS application as a service.

<!-- Application\ChatBundle\Resources\config\services.xml -->
<service id="chat_service" class="Application\ChatBundle\Services\ChatService">
    <tag name="varspool_websocket.application" key="chat" />
</service>

To install it, use composer :

composer require wrench/wrench
composer require varspool/websocket-bundle

The rest of the setup documentation is written on the repository !

I didn’t try it, but perhaps there is your solution 🙂

0

solved Websocket communication in a symfony project [closed]