Git Product home page Git Product logo

websocket-php's Introduction

Websocket Client for PHP

Build Status Coverage Status

This package mainly contains a WebSocket client for PHP.

I made it because the state of other WebSocket clients I could found was either very poor (sometimes failing on large frames) or had huge dependencies (React…).

The Client should be good. If it isn't, tell me!

The Server there because much of the code would be identical in writing a server, and because it is used for the tests. To be really useful though, there should be a Connection-class returned from a new Connection, and the Server-class only handling the handshake. Then you could hold a full array of Connections and check them periodically for new data, send something to them all or fork off a process handling one connection. But, I have no use for that right now. (Actually, I would suggest a language with better asynchronous handling than PHP for that.)

Installing

Preferred way to install is with Composer.

Just add

"require": {
  "textalk/websocket": "1.0.*"
}

in your projects composer.json.

Client usage:

require('vendor/autoload.php');

use WebSocket\Client;

$client = new Client("ws://echo.websocket.org/");
$client->send("Hello WebSocket.org!");

echo $client->receive(); // Will output 'Hello WebSocket.org!'

Developer install

Development depends on php, php-curl and php-xdebug.

# Will get composer, install dependencies and run tests
make test

Changelog

1.0.0

  • Release as production ready.
  • Adding option to set/override headers.
  • Supporting basic authentication from user:pass in URL.

websocket-php's People

Contributors

fiddur avatar armen avatar krydos avatar vkuptcov avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.