This module integrates Node.js with a Symfony2 project.
It provides an API that other bundles can use to add realtime capabilities your application, specifically enabling pushing updates to open connected clients.
-
Your user class must implement
Briareos\NodejsBundle\Entity\NodejsSubjectInterfaceNote that you don't have to implement
Briareos\NodejsBundle\Entity\NodejsSubjectInterfaceif your user class already implementsBriareos\ChatBundle\Entity\ChatSubjectInterface, since the later extends the former. -
Map the interface to your user bundle, so that relationships can work
# app/config/config.yml doctrine: orm: resolve_target_entities: Briareos\NodejsBundle\Entity\NodejsSubject: App\UserBundle\Entity\User -
To delete a session when a user logs out, add this ti your
security.yml.# app/config/security.yml firewalls: my_firewall_name: logout: invalidate_session: false handlers: - security.logout.handler.nodejs_invalidator -
Update your schema
$ php app/console doctrine:schema:update --force -
Install the required Node.js packages,
socket.ioandexpress, and all their dependencies.$ npm install socket.io expressNote: the express package must be version 3.0beta5 or newer.
-
On places that you would like to use Node.js and connect the user to the server include
BriareosNodejsBundle:Nodejs:nodejs.html.twigor use your own implementation. This must be done before including any JavaScripts that extend or depend on this bundle.