Clank is a Symfony2 Bundle designed to bring together WebSocket functionality in a easy to use application architecture.
Much like Socket.IO it provides both server side and client side code ensuring you have to write as little as possible to get your app up and running.
Powered By Ratchet and Autobahn JS, with Symfony2
Add the following to your composer.json
{
"require": {
"jdare/clank-bundle": "0.1.*"
}
}
Then update composer to install the new packages:
php composer.phar update
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new JDare\ClankBundle\JDareClankBundle(),
);
}
Add "JDareClankBundle" to your assetic bundles in app/config (this is required to render the client side code).
# Assetic Configuration
assetic:
...
bundles: [ JDareClankBundle ]
Add the following to your app/config.yml
# Clank Configuration
clank:
web_socket_server:
port: 8080 #The port the socket server will listen on
host: 127.0.0.1 #(optional) The host ip to bind to
Note: when connecting on the client, if possible use the same values as here to ensure compatibility for sessions etc.
The Server Side Clank installation is now complete. You should be able to run this from the root of your symfony installation.
php app/console clank:server
If everything is successful, you will see something similar to the following:
Starting Clank
Launching Ratchet WS Server on: *:8080
This means the websocket server is now up and running!
For further documentations on how to use Clank, please continue with the client side setup.