GithubHelp home page GithubHelp logo

fanout's Introduction

Laravel 5 Fanout.io Web Socket Service

Latest Stable Version License

A simple Laravel 5 service provider for Fanout.

Installation

The Laravel 5 Fanout Service Provider can be installed via Composer by requiring the barisbora/fanout package in your project's composer.json.

composer require barisbora/fanout

Configuration

To use the Fanout Service Provider, you must register the provider when bootstrapping your Laravel application.

Find the providers key in your config/app.php and register the Service Provider.

    'providers' => [
        // ...
        barisbora\Fanout\FanoutServiceProvider::class,
    ],

Find the aliases key in your config/app.php and register the Facade.

    'aliases' => [
        // ...
        'Fanout'    => barisbora\Fanout\Facades\FanoutFacade::class,
    ],

Usage

Run php artisan vendor:publish to publish the default config file, edit caching setting withing the resulting config/fanout.php file as desired.

Example controller method, and it's related view:

$fanout = Fanout::start();
$fanout->trigger( 'want-to-brodcast-channel-name', [
    'data1' => 'lorem ipsum dolor',
    // ...
] );

DONT FORGET change YOUR-REALM-ID and YOUR-CHANNEL

View:

@extends('layouts.default')

@section('content')

    Fanout.io Web Socket

@endsection

@section('footer')
    <script src="http://YOUR-REALM-ID.fanoutcdn.com/bayeux/static/faye-browser-min.js"></script>
    <script type="text/javascript">
        var client = new Faye.Client('http://YOUR-REALM-ID.fanoutcdn.com/bayeux');
        client.subscribe('/YOUR-CHANNEL', function (data) {
            console.log( data );
        });
    </script>
@endsection

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.