tiitoo / kijho-chat
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 2
Language:CSS
Type:symfony-bundle
Requires
- php: >=5.4
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ^2.4.8
- gos/web-socket-bundle: ^1.6
- symfony/assetic-bundle: ~2.3
- symfony/swiftmailer-bundle: ~2.3
- symfony/symfony: ~2.8|^3.0
This package is auto-updated.
Last update: 2024-11-04 11:06:54 UTC
README
Bundle for chat
Chat plugin for Symfony 2.8 and 3.x
Preview
Screenshot admin panel: local.loc/app_dev.php/chat/admin Screenshot client panel: local.loc/app_dev.php/chat/client
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:
$ 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.
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:
<?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.
Import the routing to your routing.yml
chat: resource: "@ChatBundle/Resources/config/routing.yml" prefix: /{_locale}/chat
You must add FrchoCrontaskBundle to the assetic.bundle config
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 :
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
The Server Side WebSocket installation is now complete. You should be able to run this from the root of your symfony installation.
php app/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:5555
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 :)
Ship in production
How run your websocket server in production ?
app/console gos:websocket:server --env=prod or bin/console gos:websocket:server --env=prod
Example with supervisord and other things will come
Fight against memory leak !
So why my memory increase all time ?
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 ?
app/console gos:websocket:server --profile --env=prod or bin/console gos:websocket:server --profile --env=prod
And trigger all the things.
Source
https://github.com/GeniusesOfSymfony/WebSocketBundle/blob/master/README.md