Git Product home page Git Product logo

websocketbundle's Introduction

GosWebSocketBundle

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

About

GosWebSocketBundle is a Symfony bundle designed to bring together websocket functionality in a easy to use application architecture.

Much like Socket.IO, it provides both a server and client implementation ensuring you have to write as little as possible to get your application up and running.

Powered By Ratchet and Autobahn JS, with Symfony

Demo project

To view the documentation for the 1.x versions of this bundle, please view the 1.x branch of this repository. To view the documentation for the 2.x versions of this bundle, please view the master branch of this repository.

What can I do with this bundle?

Websockets are very helpful for applications which require live activity and updates, including:

  • Chat applications
  • Real time notifications
  • Browser games

Built in features

  • PHP Websocket server (IO / WAMP)
  • PHP Websocket client (IO / WAMP)
  • JavaScript Websocket client (IO / WAMP)
  • PubSub Router
  • Remote Procedure Calls
  • User authentication
  • Periodic calls
  • Origin checker
  • Push (amqp)

Resources

Code Cookbook

Installation Instructions

Step 1: Install via Composer

If your application requires support for Symfony versions before 3.4, use the 1.x releases of this bundle. For Symfony 3.4 or newer, use the 2.x releases.

composer require gos/web-socket-bundle

Step 2: Enable the bundle

If your application is based on the Symfony Standard structure, you will need to add the bundle and its dependency, the GosPubSubRouterBundle, to your AppKernel class' registerBundles() method.

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...

            new Gos\Bundle\PubSubRouterBundle\GosPubSubRouterBundle(),
            new Gos\Bundle\WebSocketBundle\GosWebSocketBundle(),
        ];

        // ...
    }

    // ...
}

If your application is based on the Symfony Flex structure, the bundle should be automatically registered, otherwise you will need to add it and its dependency, the GosPubSubRouterBundle, to your config/bundles.php file.

<?php

return [
    // ...

    Gos\Bundle\PubSubRouterBundle\GosPubSubRouterBundle::class => ['all' => true],
    Gos\Bundle\WebSocketBundle\GosWebSocketBundle::class => ['all' => true],
];

Step 3: Configure the bundle

The following is the minimum configuration necessary to use the bundle. If you are using the Symfony Standard structure, this will be added to your app/config/config.yml file. If you are using the Symfony Flex structure, this will be added to your config/packages/gos_web_socket.yaml file.

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

Step 4: Launching the server

With the bundle installed and configured, you can now launch the websocket server through your Symfony application's command-line console.

php bin/console gos:websocket:server

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

INFO      [websocket] Starting web socket
INFO      [websocket] Launching Ratchet on 127.0.0.1:8080 PID: 12345

Congratulations, your websocket server is now running. However, you will still need to add integrations to your application to fully use the bundle.

Original Project

https://github.com/JDare/ClankBundle

websocketbundle's People

Contributors

mbabker avatar prophet777 avatar matthieuy avatar piotrantosik avatar pierre-tranchard avatar alexismarquis avatar dagio avatar kal74 avatar gittix09 avatar damonsson avatar faker-ben-ali avatar antoinetesson avatar simonheimberg avatar sadortun avatar enumag avatar juliendidier avatar jjsaunier avatar murman-lexus avatar incrediblecube avatar andreybolonin avatar anboo avatar vlad-iliescu avatar tkuska avatar skroczek avatar bryant1410 avatar stralytic avatar kaa4ever avatar kbosilkov avatar jereth avatar jbbrunsveld avatar

Watchers

James Cloos 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.