PHPackages                             francium/diffsocket - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. francium/diffsocket

ActiveVcs[DevOps &amp; Deployment](/categories/devops)

francium/diffsocket
===================

A PHP Library for serving Multiple WebSocket Services in a single server

v0.1.1(10y ago)3641[1 PRs](https://github.com/subins2000/Francium-DiffSocket/pulls)Apache 2.0PHP &gt;=5.3.9

Since May 30Compare

[ Source](https://github.com/subins2000/Francium-DiffSocket)[ Packagist](https://packagist.org/packages/francium/diffsocket)[ RSS](/packages/francium-diffsocket/feed)WikiDiscussions Synced yesterday

READMEChangelogDependencies (4)Versions (3)Used By (0)

DiffSocket
==========

[](#diffsocket)

[![Build Status](https://camo.githubusercontent.com/2ace634a8a40ce9d906db62fcebc5263a8327f4d0b3b6c97cd750ea7e0438434/68747470733a2f2f7472617669732d63692e6f72672f737562696e73323030302f4672616e6369756d2d44696666536f636b65742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/subins2000/Francium-DiffSocket)

A PHP Library for serving multiple WebSocket services through a **single port**.

Normally, if you want to run multiple services, you would have to run WebSocket server on different ports. With DiffSocket, you can use a single port for different services.

Installation
------------

[](#installation)

```
composer require francium/diffsocket
```

[Tutorial](http://subinsb.com/run-multiple-websocket-services-on-same-port)

Why don't I use different ports for different services ?
--------------------------------------------------------

[](#why-dont-i-use-different-ports-for-different-services-)

Some hosting providers don't allow you to bind on multiple ports, especially if you're using a **Free plan**. An example is [OpenShift](http://openshift.redhat.com).

I created DiffSocket, because my WebSocket server is hosted on OpenShift and needed a way to serve multiple WebSocket services through a single port.

Demos
-----

[](#demos)

These different services are provided through a single WebSocket port (ws-subins.rhcloud.com:8000) :

- [Finding Value Of Pi](http://demos.subinsb.com/pi/)
- [Advanced Live Group Chat With PHP, jQuery &amp; WebSocket](http://demos.subinsb.com/php/advanced-chat-websocket/)
- [Live Group Chat With PHP, jQuery &amp; WebSocket](http://demos.subinsb.com/php/websocketChat)

Usage
-----

[](#usage)

### Server

[](#server)

DiffSocket uses [Ratchet](https://github.com/cboden/ratchet) for the WebSocket server. You should learn Ratchet to create services.

- Configure server :

    ```
