2017 © Pedro Peláez
 

library lumen-socketio

The Laravel Lumen Socketio Broadcasting.

image

vluzrmos/lumen-socketio

The Laravel Lumen Socketio Broadcasting.

  • Thursday, April 21, 2016
  • by vluzrmos
  • Repository
  • 3 Watchers
  • 17 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 11 Versions
  • 7 % Grown

The README.md

Lumen + Socket.io e Redis Broadcasting

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

THAT PACKAGE IS ABANDONED, PLEASE CONSIDER TO USE LARAVEL|LUMEN NATIVE SOLUTION: https://laravel.com/docs/5.2/events#broadcast-data, (*2)

Instalation

composer require vluzrmos/lumen-socketio

Add the Services Providers, on bootstrap/app.php:, (*3)

$app->register('Vluzrmos\Socketio\SocketioServiceProvider');

Configuration

Install NodeJs dependencies:, (*4)

npm install --save express http-server redis ioredis socket.io

Copy the file vendor/vluzrmos/lumen-socketio/Vluzrmos/Socketio/socket.js to your project root., (*5)

Modify it whatever you want, see the code: socket.js, (*6)

Obs.: Remember to install a Redis Server, (*7)

On your view, you have to use socket.io.js, (*8)

<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title> Lumen Socket.IO </title>
    <script src="//cdn.socket.io/socket.io-1.3.5.js"></script>
</head>
<body>

    <script type="text/javascript">
        var socket = io('http://localhost:8080'); //Some host and port configured in socket.js

        socket.on('channel:awesome-event', function (data) {
            console.log(data); 
        });
    </script>
</body>
</html>

Usage

Run your socket.io server:, (*9)

# that socket.js file is in your project root
node socket.js

On your Lumen App:, (*10)

$app->get('/publish', function() {
    publish('channel', 'awesome-event', 'An message');
    publish('channel', 'awesome-event', ['message' => 'An message', 'user' => \App\User::first()]);
});


//or, in your controller or some else method (using Dependency Injection)

public function publishSomethingAwesome(\Vluzrmos\Socketio\Contracts\Broadcast $broadcast){
    $broadcast->publish('channel', 'awesome-event', 'An message');

    // or just use the helper without inject \Vluzrmos\Socketio\Contracts\Broadcast

    publish('channel', 'awesome-event', 'An message');
}

And finish, run your lumen app:, (*11)

php artisan serve

The Versions

21/04 2016

dev-master

9999999-dev

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

21/04 2016

v0.1.5

0.1.5.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

18/06 2015

v0.1.4

0.1.4.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

09/05 2015

v0.1.3

0.1.3.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

09/05 2015

v0.1.2

0.1.2.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

09/05 2015

v0.1.1

0.1.1.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

09/05 2015

v0.1.0

0.1.0.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

05/05 2015

v0.0.4

0.0.4.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

05/05 2015

v0.0.3

0.0.3.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

05/05 2015

v0.0.2

0.0.2.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets

05/05 2015

v0.0.1

0.0.1.0

The Laravel Lumen Socketio Broadcasting.

  Sources   Download

dbad

The Requires

 

laravel lumen broadcasting socket.io websockets