Code Monkey home page Code Monkey logo

websocketbundle's Introduction

Gos Web Socket Bundle

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

About

Gos Web Socket 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

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)

Resources

Code Cookbook

Overview

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

<?php
// 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
gos_web_socket:
    server:
        port: 8080        #The port the socket server will listen on
        host: 127.0.0.1   #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: 127.0.0.1:8080

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

https://github.com/JDare/ClankBundle

websocketbundle's People

Contributors

prophet777 avatar mbabker avatar matthieuy avatar piotrantosik avatar dagio avatar gittix09 avatar damonsson avatar juliendidier avatar antoinetesson avatar jjsaunier avatar stralytic avatar pierre-tranchard avatar skroczek avatar

Watchers

James Cloos avatar Hajri_Aymen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.