PHPackages                             goodizer/yii2-websocket - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. goodizer/yii2-websocket

ActiveYii2-components[HTTP &amp; Networking](/categories/http)

goodizer/yii2-websocket
=======================

Components for Yii2.

v1.0.8(5y ago)26703MITPHPPHP ^7.3

Since Jul 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/goodizer/yii2-websocket)[ Packagist](https://packagist.org/packages/goodizer/yii2-websocket)[ Docs](https://github.com/goodizer/yii2-websocket)[ RSS](/packages/goodizer-yii2-websocket/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (10)Used By (0)

yii2-helpers
============

[](#yii2-helpers)

[![Latest Stable Version](https://camo.githubusercontent.com/427529f36cd845d0edef9ce6d9cbf496de21e4ce0fd288579d32de265e8a7f22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676f6f64697a65722f796969322d776562736f636b65742e737667)](https://packagist.org/packages/goodizer/yii2-websocket)[![License](https://camo.githubusercontent.com/d046bcba97e41fbdda5da4604350da7b801b91cdcc3efca9316da4cf02bae6f9/68747470733a2f2f706f7365722e707567782e6f72672f676f6f64697a65722f796969322d776562736f636b65742f6c6963656e7365)](https://packagist.org/packages/goodizer/yii2-websocket)[![Total Downloads](https://camo.githubusercontent.com/0ae841b9fdcb4c1ceb0da249b99db84243dc2fa8107dc7a27c5f4cd57d2cc85c/68747470733a2f2f706f7365722e707567782e6f72672f676f6f64697a65722f796969322d776562736f636b65742f646f776e6c6f616473)](https://packagist.org/packages/goodizer/yii2-websocket)[![Monthly Downloads](https://camo.githubusercontent.com/c8a23b399a80954e9c233c59dc6f5f1a0f665efc24b91bb74a20eb354b68566a/68747470733a2f2f706f7365722e707567782e6f72672f676f6f64697a65722f796969322d776562736f636b65742f642f6d6f6e74686c79)](https://packagist.org/packages/goodizer/yii2-websocket)[![Daily Downloads](https://camo.githubusercontent.com/0e3584540e99d45212d0b00dd9c6dccedebafe126e0e23980df5dbc0f099b0fe/68747470733a2f2f706f7365722e707567782e6f72672f676f6f64697a65722f796969322d776562736f636b65742f642f6461696c79)](https://packagist.org/packages/goodizer/yii2-websocket)

Web-socket component based on workerman/workerman for Yii2

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

> Note: Check the [composer.json](https://github.com/goodizer/yii2-websocket/blob/master/composer.json) for this extension's requirements and dependencies.

Either run

```
$ php composer.phar require goodizer/yii2-websocket

```

or add

```
"goodizer/yii2-websocket": "*"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### GridSearchHelper

[](#gridsearchhelper)

Set websocket component config.

```
    'components' => [
        ...
        'websocketServer' => [
          'class' => 'goodizer\websocket\Server',
          'commandClass' => 'console\extensions\Commands',//Your class that inherit goodizer\websocket\Commands
            'host' => $params['websocketServer']['host'] ?? 'localhost',
            'port' => $params['websocketServer']['port'] ?? 8000,
            'isSecure' => $params['websocketServer']['isSecure'] ?? false,
            'localCert' => $params['websocketServer']['localCert'] ?? null,
            'localPk' => $params['websocketServer']['localPk'] ?? null,
        ],
        ...
    ],
```

Create controller

```
