\AppWebSocket

A WebSocket class

Mange Web Socket connections Allow presenter to control slides Send slides to all viewers

Summary

Methods
Properties
Constants
__construct()
onOpen()
onMessage()
onClose()
onError()
No public properties found
No constants found
init()
addPresenter()
removePresenter()
isPresenter()
sendMessageToAll()
stats()
$clients
$slide
$slidePath
$slideLast
$slideAction
$slideNumber
$slideFileName
$presenterResourcesId
N/A
No private methods found
No private properties found
N/A

Properties

$clients

$clients : \SplObjectStorage

Store clients Web Socket connection

Type

\SplObjectStorage

$slide

$slide : object

Store Slide object

Type

object

$slidePath

$slidePath : string

Store path of presentation file

Type

string

$slideLast

$slideLast : string

Store contents of last active slide

Type

string

$slideAction

$slideAction : string

Store presenter last slide action

Type

string

$slideNumber

$slideNumber : integer

Slide number

Type

integer

$slideFileName

$slideFileName : string

Store filename of presentation file

Type

string

$presenterResourcesId

$presenterResourcesId : array

Presenters resource id

Type

array

Methods

__construct()

__construct() 

Initialize Web Socket connection

onOpen()

onOpen(\Ratchet\ConnectionInterface  $conn) 

New Web Socket connection is opened

Parameters

\Ratchet\ConnectionInterface $conn

The socket/connection that just connected to your application

onMessage()

onMessage(\Ratchet\ConnectionInterface  $from, string  $msg) 

Send message ie slide content to all active Web Socket connections

Parameters

\Ratchet\ConnectionInterface $from

Sender Web Socket connection

string $msg

Slide content

onClose()

onClose(\Ratchet\ConnectionInterface  $conn) 

Web Socket connection is closed

Parameters

\Ratchet\ConnectionInterface $conn

The socket/connection that just disconnected

onError()

onError(\Ratchet\ConnectionInterface  $conn, \Exception  $e) 

Error with one of the sockets Or somewhere in the app

Parameters

\Ratchet\ConnectionInterface $conn

Client Web Socket connection

\Exception $e

Exception

init()

init() 

Initialize presentation broadcast Send last active slide to all active Web Socket connections

addPresenter()

addPresenter(integer  $resourceId) 

Add presenter to presenter list

Parameters

integer $resourceId

ResourceId of presenter

removePresenter()

removePresenter(integer  $resourceId) 

Remove presenter from presenter list

Parameters

integer $resourceId

ResourceId of presenter

isPresenter()

isPresenter(integer  $resourceId) : boolean

Check Web Socket Connection is presenter or not

Parameters

integer $resourceId

ResourceId for Web Socket connection

Returns

boolean —

Client is presenter or not

sendMessageToAll()

sendMessageToAll() 

Send message ie slide content to all active Web Socket connections

stats()

stats() 

Stats of active Web Socket connections and presenters