2017 © Pedro Peláez
 

symfony-bundle kijho-chat

image

kijho/kijho-chat

  • Sunday, February 11, 2018
  • by kijho-technologies
  • Repository
  • 3 Watchers
  • 0 Stars
  • 374 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

kijho-chat

Bundle for chat, (*1)

Chat plugin for Symfony 2.8 and 3.x, (*2)

Preview

Screenshot admin panel: local.loc/app_dev.php/chat/admin alt tag Screenshot client panel: local.loc/app_dev.php/chat/client alt tag, (*3)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*4)

$ composer require kijho/kijho-chat dev-master

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*5)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*6)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Gos\Bundle\WebSocketBundle\GosWebSocketBundle(), //bundle websockets for chat
            new Gos\Bundle\PubSubRouterBundle\GosPubSubRouterBundle(), //bundle websockets for chat
            new Kijho\ChatBundle\ChatBundle(),
        );

        // ...
    }

    // ...
}

In order to see the view, the bundle comes with a implementation., (*7)

Import the routing to your routing.yml, (*8)

chat:
    resource: "@ChatBundle/Resources/config/routing.yml"
    prefix:   /{_locale}/chat

You must add FrchoCrontaskBundle to the assetic.bundle config, (*9)

assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ChatBundle]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:

Enabled locale

framework:
    translator:      { fallbacks: ["%locale%"] }

Web Socket Configuration

gos_web_socket:
    shared_config: true
    server:
        port: 5555                #The port the socket server will listen on
        host: 127.0.0.1           #The host ip to bind to
        router:
            resources:
                - "@ChatBundle/Resources/config/routing/chat.yml"

Update the database schema and assets :, (*10)

symfony 3.0
bin/console doctrine:schema:update --force
bin/console assets:install
bin/console assetic:dump

symfony 2.8
app/console doctrine:schema:update --force
app/console assets:install
app/console assetic:dump

Launching the Server, (*11)

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

php app/console gos:websocket:server

If everything is successful, you will see something similar to the following:, (*13)

Starting Gos WebSocket
Launching Ratchet WS Server on: 127.0.0.1:5555

This means the websocket server is now up and running !, (*14)

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

Ship in production

How run your websocket server in production ?, (*16)

app/console gos:websocket:server --env=prod or bin/console gos:websocket:server --env=prod, (*17)

Example with supervisord and other things will come, (*18)

Fight against memory leak !, (*19)

So why my memory increase all time ?, (*20)

In development mode it's normal. (Don't bench memory leaks in this env, never) append your command with --env=prod Are you using fingers_crossed handler with monolog ? If yes, switch to stream. That's fingers_crossed expected behavior. It stores log entries in memory until event of action_level occurs. Dependencies of this bundle can have some troubles :( (But I can't do nothing, and if it's the case, downgrade or freeze impacted dependency) It's your fault :) Dig in you own code. How bench about memory leaks ?, (*21)

app/console gos:websocket:server --profile --env=prod or bin/console gos:websocket:server --profile --env=prod, (*22)

And trigger all the things., (*23)

Source

https://github.com/GeniusesOfSymfony/WebSocketBundle/blob/master/README.md, (*24)

The Versions