This is a Proof of Concept (POC) demonstrating how to implement a WebSocket server and a queuing system using Symfony 6.
- WebSocket Server: Real-time communication capabilities.
- Queuing System: Asynchronous message handling to improve performance.
Follow these steps to get the project up and running:
Navigate to the packages/server
directory and build the Docker containers.
cd packages/server
docker-compose up -d
Create the PostgreSQL database and run the migrations to set up the required tables.
docker-compose exec php bin/console doctrine:database:create
docker-compose exec php bin/console doctrine:migrations:migrate
Run the WebSocket server for real-time functionality. The -vv
flag enables verbose output.
docker-compose exec php bin/console websocket:server:run -vv
Execute this command to test the WebSocket server's functionality.
docker-compose exec php bin/console websocket:server:test
To push a notification to all connected clients or to a single client identified by a specific resource id
, run:
docker-compose exec php bin/console websocket:notification:push "Your Toast!" [--resource-id=<RESOURCE_ID>] [--delay=<DELAY_IN_SECONDS>]
Replace <RESOURCE_ID>
with the resource id of the client you wish to target, or omit it to notify all clients.