2017 © Pedro Peláez
 

library ratchet-json-server

image

carnage/ratchet-json-server

  • Monday, September 19, 2016
  • by carnage
  • Repository
  • 1 Watchers
  • 8 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

ratchet-json-server

An extension for ratchet enabling communication via json serialised strings, (*1)

Wrapped by Ratchet's Websocket Server, Wraps your app., (*2)

Will automatically serialise and unserialise json into php arrays and back again, (*3)

Install:

composer require carnage/ratchet-json-server ~0.1, (*4)

Usage:

<?php
// Your shell script
use Ratchet\WebSocket\WsServer;
use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Carnage\JsonServer\JsonServer;

$ws = new WsServer(new JsonServer(new MyChat));
$ws->disableVersion(0); // old, bad, protocol version

// Make sure you're running this as root
$server = IoServer::factory(new HttpServer($ws));
$server->run();

MyChat can now send arrays of data using $conn->send(['name' => 'Fred', 'message' => 'hi']); and have them automatically json serialised. Json strings coming in from your client will be deserialised and presented to the onMessage method of MyChat as an array., (*5)

The Versions

19/09 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chris Riley

04/05 2015

0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Chris Riley