2017 © Pedro Peláez
 

library socket

Thruster Socket Component

image

thruster/socket

Thruster Socket Component

  • Thursday, January 14, 2016
  • by gcds
  • Repository
  • 1 Watchers
  • 0 Stars
  • 266 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 14 % Grown

The README.md

Socket Component

[Latest Version] (https://github.com/ThrusterIO/socket/releases) [Software License] (LICENSE) [Build Status] (https://travis-ci.org/ThrusterIO/socket) [Code Coverage] (https://scrutinizer-ci.com/g/ThrusterIO/socket) [Quality Score] (https://scrutinizer-ci.com/g/ThrusterIO/socket) [Total Downloads] (https://packagist.org/packages/thruster/socket), (*1)

[Email] (mailto:team@thruster.io), (*2)

The Thruster Socket Component., (*3)

Library for building an evented socket server., (*4)

The socket component provides a more usable interface for a socket-layer server or client based on the EventLoop and Stream components., (*5)

Server

The server can listen on a port and will emit a connection event whenever a client connects., (*6)

Connection

The Connection is a readable and writable Stream. The incoming connection represents the server-side end of the connection., (*7)

It MUST NOT be used to represent an outgoing connection in a client-side context. If you want to establish an outgoing connection, use the SocketClient component instead., (*8)

Install

Via Composer, (*9)

``` bash $ composer require thruster/socket, (*10)



## Usage Here is a server that closes the connection if you send it anything. ```php $loop = new EventLoop(); $socket = new Server($loop); $socket->on('connection', function ($conn) { $conn->write("Hello world!\n"); $conn->on('data', function ($data) use ($conn) { $conn->close(); }); }); $socket->listen(1337); $loop->run();

You can change the host the socket is listening on through a second parameter provided to the listen method:, (*11)

$socket->listen(1337, '192.168.0.1');

Testing

bash $ composer test, (*12)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*13)

License

Please see License File for more information., (*14)

The Versions

14/01 2016

dev-master

9999999-dev https://thruster.io

Thruster Socket Component

  Sources   Download

MIT

The Requires

 

The Development Requires

socket thruster

14/01 2016

1.1.0

1.1.0.0 https://thruster.io

Thruster Socket Component

  Sources   Download

MIT

The Requires

 

The Development Requires

socket thruster

10/01 2016

1.0.1

1.0.1.0 https://thruster.io

Thruster Socket Component

  Sources   Download

MIT

The Requires

 

The Development Requires

socket thruster

12/12 2015

1.0.0

1.0.0.0 https://thruster.io

Thruster Socket Component

  Sources   Download

MIT

The Requires

 

The Development Requires

socket thruster