Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via composer

react/socket v1.14.0

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP
Package summary
Share
0
issues
1
license
7
MIT
Package created
10 May 2012
Version published
25 Aug 2023
Maintainers
5
Total deps
7
Direct deps
5
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
7 Packages, Including:
evenement/evenement@v3.0.2
react/cache@v1.2.0
react/dns@v1.12.0
react/event-loop@v1.5.0
react/promise@v3.1.0
react/socket@v1.14.0
react/stream@v1.3.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

5
All Dependencies CSV
β“˜ This is a list of react/socket 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
evenement/evenementv3.0.24.6 kBMIT
prod
react/dnsv1.12.0-MIT
prod
react/event-loopv1.5.039.55 kBMIT
prod
react/promisev3.1.0-MIT
prod
react/streamv1.3.035.67 kBMIT
prod

Visualizations

Frequently Asked Questions

What does react/socket do?

React/Socket is a library for ReactPHP that provides async, streaming plaintext TCP/IP and secure TLS socket server and client connections. It is designed to simplify the process of working with networking servers and clients. With its server component, you can build networking servers that accept incoming connections from networking clients such as an HTTP server. On the other hand, its client component allows you to build networking clients that establish outgoing connections to networking servers, like an HTTP or database client.

How do you use react/socket?

Using react/socket is straightforward. It can be included in your project via composer. Here is a quick use case of a server that closes the connection if you send it anything:

$socket = new React\Socket\SocketServer('127.0.0.1:8080');

$socket->on('connection', function (React\Socket\ConnectionInterface $connection) {
    $connection->write("Hello " . $connection->getRemoteAddress() . "!\n");
    $connection->write("Welcome to this amazing server!\n");
    $connection->write("Here's a tip: don't say anything.\n");

    $connection->on('data', function ($data) use ($connection) {
        $connection->close();
    });
});

And here's a client that outputs the output of said server and then attempts to send it a string:

$connector = new React\Socket\Connector();

$connector->connect('127.0.0.1:8080')->then(function (React\Socket\ConnectionInterface $connection) {
    $connection->pipe(new React\Stream\WritableResourceStream(STDOUT));
    $connection->write("Hello World!\n");
}, function (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
});

Where are the react/socket docs?

The react/socket documentation can be found within the GitHub project under the heading "Connection usage". Here you would find detailed information on how to implement and use the different interfaces and methods provided by the library. It explains how to use the ConnectionInterface, what the ServerInterface is responsible for, and how to use the ServerInterface to listen for connection events, error events, and how to use methods associated with it.