dickyermawan/yii2-socketio

Socket.IO for real-time app

Installs: 82

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Language:JavaScript

Type:yii2-extension

v1.0 2019-07-28 10:40 UTC

This package is auto-updated.

Last update: 2024-04-28 22:05:09 UTC


README

Socket.IO for real-time app

Installation

The preferred way to install this extension is through composer.

Either run

composer require dickyermawan/yii2-socketio

or add

"dickyermawan/yii2-socketio": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

//in components array
'socket' => [
    'class' => 'dickyermawan\socketio\ElephantIo',
    'host' => 'http://localhost:8089',
    'options' => [
        'headers' => [
            'X-My-Header: MyHead',
            'Authorization: Bearer 12345asdf'
        ]
    ]
]

//in your controller:
Yii::$app->socket->emit('realTime', [
    'param1' => 'param1',
    'param2' => 'param2'
]);
Yii::$app->socket->close();