Skip to content
〽️ Symfony2 server side (Ratchet) & client websocket (Autobahn)
Branch: master
Clone or download
mbabker Merge pull request #368 from alexismarquis/patch-1
Make ServerBuilder implement ServerBuilderInterface
Latest commit e2f61a5 Feb 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Client Test the in memory driver Dec 30, 2018
Command PHPCS Nov 18, 2018
DataCollector Add setName to the PusherInterface Dec 2, 2018
DependencyInjection Test for completeness, use namespaced exception Feb 8, 2019
Event B/C Break - Refactor client storage to save the token from the sessio… Dec 5, 2018
Periodic Restructure the way the PDO Periodic Ping service is configured, add … Dec 6, 2018
RPC rpc is now running via pubsub router Mar 22, 2015
Resources Update config reference for 2.0 changes Feb 8, 2019
Server Make ServerBuilder implement ServerBuilderInterface Feb 12, 2019
Tests Interface for the server builder, test WebSocketServer Feb 8, 2019
Topic Test ConnectionPeriodicTimer Feb 8, 2019
.php_cs inital commit Feb 9, 2015
.scrutinizer.yml Fix case on Scrutinizer test path config Dec 2, 2018
LICENSE inital commit Feb 9, 2015 Doc updates Jan 2, 2019
phpunit.xml.dist Add tests Apr 5, 2016
ws_logo.jpeg add websocket logo Jun 6, 2015

Gos Web Socket Bundle

Gitter Latest Stable Version Latest Unstable Version Total Downloads License Build Status Scrutinizer Code Quality Websocket


Gos Web Socket is a Symfony 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 Symfony

Demo project

What can I do with this bundle

Make real time application like

  • Chat Application
  • Real time notification
  • Browser games

More commonly, all application who meet real time.

Built in feature

  • PHP Websocket server (IO / WAMP)
  • PHP Websocket client (IO / WAMP)
  • JS Websocket client (IO / WAMP)
  • PubSub (with routing)
  • Remote procedure call
  • User authentication through websocket
  • Periodic call
  • Origin checker
  • Push (zmq, amqp)


Code Cookbook


You must achieve these following steps before send your first message through websocket.

  1. Install the bundle
  2. Create you first topic handler
  3. Implement the client (Javascript)

Let's do it !

Installation Instructions

Step 1: Install via composer

composer require gos/web-socket-bundle

Step 2: Add to your App Kernel

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Gos\Bundle\WebSocketBundle\GosWebSocketBundle(),
        new Gos\Bundle\PubSubRouterBundle\GosPubSubRouterBundle(),

Step 3: Configure WebSocket Server

Add the following to your app/config.yml

# Web Socket Configuration
        port: 8080        #The port the socket server will listen on
        host:   #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.

Step 4: Launching the Server

The Server Side WebSocket installation is now complete. You should be able to run this from the root of your symfony installation.

For Symfony 2.7 & 2.8

php app/console gos:websocket:server

For Symfony >3.x

php bin/console gos:websocket:server

If everything is successful, you will see something similar to the following:

Starting Gos WebSocket
Launching Ratchet WS Server on:

This means the websocket server is now up and running !

From here, only the websocket server is running ! That doesn't mean you can subscribe, publish, call. Follow next step to do it :)

Next Steps

For further documentations on how to use WebSocket, please continue with the client side setup.

Original Project

You can’t perform that action at this time.