PHPackages                             icicleio/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. icicleio/websocket

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

icicleio/websocket
==================

Asynchronous WebSocket component for Icicle.

v0.1.0(10y ago)242.4k3[1 issues](https://github.com/icicleio/websocket/issues)MITPHP

Since Mar 11Pushed 9y ago4 watchersCompare

[ Source](https://github.com/icicleio/websocket)[ Packagist](https://packagist.org/packages/icicleio/websocket)[ Docs](http://icicle.io)[ RSS](/packages/icicleio-websocket/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (7)Versions (4)Used By (0)

WebSockets for Icicle
=====================

[](#websockets-for-icicle)

**Asynchronous, non-blocking WebSocket server.**

This library is a component for [Icicle](https://github.com/icicleio/icicle) that provides an asynchronous WebSocket server that can handle normal HTTP requests and WebSocket requests on the same port. Like other Icicle components, this library uses [Coroutines](https://icicle.io/docs/manual/coroutines/) built from [Awaitables](https://icicle.io/docs/manual/awaitables/) and [Generators](http://www.php.net/manual/en/language.generators.overview.php) to make writing asynchronous code more like writing synchronous code.

[![Build Status](https://camo.githubusercontent.com/717596d4f7884aa265da19c3cbbae01f79de27ef4538850bbd65bb4a5eb0418a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f696369636c65696f2f776562736f636b65742f76312e782e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/icicleio/websocket)[![Coverage Status](https://camo.githubusercontent.com/941ab2f87f8b90dee655c41c62b1a938da94ec0e6e20cbf70b7ddbcfbeefde46/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f696369636c65696f2f776562736f636b65742f76312e782e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/icicleio/websocket)[![Semantic Version](https://camo.githubusercontent.com/772adbc52e5d59a963dda8257ffc2038eebcaea5a0a0da5edfa0cf87c991fd5b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f696369636c65696f2f776562736f636b65742e7376673f7374796c653d666c61742d737175617265)](http://semver.org)[![MIT License](https://camo.githubusercontent.com/136f5ab7e45d97cfa9315b316c1c904643d45f28e1b831266f41ce1cca4c87e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696369636c65696f2f776562736f636b65742e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![@icicleio on Twitter](https://camo.githubusercontent.com/fb16a2e03bb85dd9926a15e837d3754b7766046281e2698271930aadbcd972cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d253430696369636c65696f2d3531383963372e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/icicleio)

#### Documentation and Support

[](#documentation-and-support)

- [Full API Documentation](https://icicle.io/docs)
- [Official Twitter](https://twitter.com/icicleio)
- [Gitter Chat](https://gitter.im/icicleio/icicle)

##### Requirements

[](#requirements)

- PHP 5.5+ for v0.1.x branch (current stable) and v1.x branch (mirrors current stable)
- PHP 7 for v2.0 (master) branch supporting generator delegation and return expressions

##### Suggested

[](#suggested)

- [openssl extension](http://php.net/manual/en/book.openssl.php): Required to create secure WebSocket servers.

##### Installation

[](#installation)

The recommended way to install is with the [Composer](http://getcomposer.org/) package manager. (See the [Composer installation guide](https://getcomposer.org/doc/00-intro.md) for information on installing and using Composer.)

Run the following command to use this library in your project:

```
composer require icicleio/websocket
```

You can also manually edit `composer.json` to add this library as a project requirement.

```
// composer.json
{
    "require": {
        "icicleio/websocket": "^0.1"
    }
}
```

#### Example

[](#example)

The example below creates a simple HTTP server that accepts WebSocket connections on the path `/echo`, otherwise responding with a 404 status code on other paths.

```
#!/usr/bin/env php
