Download the PHP package tiitoo/symfony3-nodesjssocket without Composer

On this page you can find all versions of the php package tiitoo/symfony3-nodesjssocket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony3-nodesjssocket

Installation

Introduction

Bundle provides to emiting an events as live application and non-blocking javascript server and PHP emiters. Based on node.js, socket.io and elephant.io. Integrated packages with other vendor packages are included and binded to bundle.

Disclaimer

A bundle is origin from yii-node-socket extension on YiiNodeSocket and is rewriten for Symfony bundle package. Some of components are from orignal vendors such as socket.io, elephant.io, node.js and libraries from YiiNodeSocket.

Prerequisites

Install nodejs package on your system. Then find path of node and bind with node command. Find a node on a system:

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:

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

Step 2: Enable the Bundle

Activate a bundle by adding a follow bundle into AppKernel: app/AppKernel.php file of your project:

Step 3: Cache and logs files

Make sure that in app directory cache and logs files are writeable. A bundle requires logs directory to store node socket emit and action events.

Step 4: Add configuration

Add a configuration attributes inside config.yml as sample:

Make sure that your hostname is same in your project from [yourhostname].

If you add origin server it should be in a lists from hosts and listener hosts.

By default node socket uses session storage and cookie to share information between server socket and client. A default name sessionVarName is PHPSESSID. If your application uses same session name change it to avoid conflicts.

When starting node socket it will store ID of system process into file. It uses for starting and stopping node.js services.

A service uses log file to store node events, triggers, callbacks, messages and status of node service. By default node starts as background service inside server.js file.

Step 5: Command event service

To staring a node server use console to activate service:

Get a console help intro:

Starting a service:

By default if service has already running it will show process ID of running service. You can stop or restart a service.

Terminating a service:

Restarting a service:

Restarting service will kill previously process if started and starting a new node service.

Check status and process ID of service:

If you encountering or if you prefer to manually start you can check your process id by using ps command to find node service:

Then find a symfony node service node server.js and manually kill it using

Step 6: Put assets to your template resource

For loading socket.io and emiting events you need to put a template code inside head tag. Remove a jquery CDN if you already have in your template:

Before body tag put socket.io listener for incoming emits and status of socket:

A bundle requires in a web directory to include JS and CSS file you should check and include your files into web/bundles/reactorcodersymfony2nodesocket directory. To publish bundle into web directory and loading automaticaly use:

A public resource is located under Reactorcoder/Symfony2NodesocketBundle/Resources/public directory.

Step 7: Base class in controllers

In your controller (sending events):

Append a code after login function, load nodesocket class to register session and authenticate user into node socket. This should be done only once on login:

For receiving events use template.

Step 8: Emit global event

To send event message via socket using event name use:

Step 9: Emit user event

To send event message via socket using user ID and if you previously set SetUserId() on login use:

User will receive if is previously logged using createAuthenticationFrame() as user ID 2. A code sample is for authentication on Step 6.

To receive message just call template from Step 6.

Example

Full working sample demo is on Reactorcoder/Symfony2NodesocketBundle/Controller and Reactorcoder/Symfony2NodesocketBundle/Resources/views folder.

Contributing

Thank you for contributing, suggestions, coding and maintenances package that will helps others contributors, developers and end users. Feel free if you have suggestions, contributing or recommendations.


All versions of symfony3-nodesjssocket with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.0
symfony/console Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tiitoo/symfony3-nodesjssocket contains the following files

Loading the files please wait ....