Broadcastt
, (*1)
Realtime web applications are the future. Broadcastt provides tools to help developers create realtime applications., (*2)
Laravel HTTP Library
Be aware that this library is still in beta and not reached the first MAJOR version., (*3)
Semantic Versioning 2.0.0, (*4)
Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable., (*5)
This library is compatible with Laravel 5.5+, (*6)
This is an HTTP library for Laravel. If you are looking for a client library or a different server library please check out our list of libraries., (*7)
For tutorials and more in-depth documentation, visit the official site., (*8)
Documentation
First steps
Require this package, with Composer, (*9)
composer require broadcastt/broadcastt-laravel-http
The Broadcastt service provider is registered automatically., (*10)
Broadcastt\Laravel\BroadcasttServiceProvider
If you want you can register the Broadcastt facade., (*11)
'Broadcastt' => Broadcastt\Laravel\Facades\Broadcastt::class
Configuration
To configure only the Broadcasting driver you have to modify config/broadcasting.php
. You have to have an item in the connections
array with its driver set to broadcastt
., (*12)
'broadcastt' => [
'driver' => 'broadcastt',
'id' => env('BROADCASTER_APP_ID'),
'key' => env('BROADCASTER_APP_KEY'),
'secret' => env('BROADCASTER_APP_SECRET'),
'cluster' => env('BROADCASTER_APP_CLUSTER'),
],
The recommended way is to use environment variables or use .env
to configure these data., (*13)
You can also use the PUSHER_APP_KEY
, PUSHER_APP_SECRET
, PUSHER_APP_ID
and PUSHER_APP_CLUSTER
environment variables respectively., (*14)
To configure other connection for the facade you should publish config/broadcastt.php
., (*15)
php artisan vendor:publish --provider="Broadcastt\Laravel\BroadcasttServiceProvider"
In the published config/broadcasting.php
file you can define many connections., (*16)
id
(Integer)
The id of the application, (*17)
key
(String)
The key of the application, (*18)
secret
(String)
The secret of the application, (*19)
cluster
(String) Optional
The cluster of the application, (*20)
Default value: eu
, (*21)
Additional options
useTLS
(String)
Short way to change scheme
to https
and port
to 443
, (*22)
debug
(Boolean)
Turns on debugging for all requests, (*23)
Default value: false
, (*24)
basePath
(String)
The base of the path what the request will call, (*25)
Default value: /apps/{AppId}
, (*26)
scheme
(String)
E.g. http or https, (*27)
Default value: http
, (*28)
host
(String)
The host e.g. cluster.broadcasttapp.com. No trailing forward slash, (*29)
Default value: eu.broadcasttapp.xyz
If the cluster is not set during initialization, (*30)
port
(String)
The http port, (*31)
Default value: 80
, (*32)
timeout
(String)
The http timeout, (*33)
Default value: 30
, (*34)
Usage of broadcaster
BroadcasttServiceProvider
registers a driver for Broadcasting, so in config/broadcasting.php
you can use broadcastt
driver for broadcasting., (*35)
For example you can set BROADCAST_DRIVER
environment variable to broadcastt
., (*36)
Usage of facade
client($connection = null)
Returns a client instance, (*37)
connection($connection = null)
Alias for client($connection = null)
, (*38)
trigger($channels, $name, $data, $socketId = null, $jsonEncoded = false)
Trigger an event by providing event name and payload., (*39)
Optionally provide a socket ID to exclude a client (most likely the sender)., (*40)
triggerBatch($batch = [], $encoded = false)
Trigger multiple events at the same time., (*41)
get($path, $params = [])
GET arbitrary REST API resource using a synchronous http client., (*42)
All request signing is handled automatically., (*43)
Contributing
Everyone is welcome who would help to make this library "Harder, Better, Faster, Stronger"., (*44)