\BEAR_Resource_Server

BEARリソースsocketサーバー

リソースをソケットでサービスします。
サーバーはデーモンモードでちあがります。

クライアントはソケット接続した後以下のようにリソースをCRUDで操作します。

read user/blog?id=10&blog_id=20
update user/blog?id=10&blog_id=20&name=new

サーバーに接続しているクライアントに一斉に通知するのに
broadcastというメソッドが使用できます。一斉通知以外はreadと同じです。

broadcast user/blog?id=10&blog_id=20

Summary

Methods
Properties
Constants
__construct()
onInject()
setConfig()
getConfig()
setService()
start()
No public properties found
No constants found
_exception()
$_config
N/A
_printStartUpinfo()
No private properties found
N/A

Properties

$_config

$_config : array

Class config

Type

array

Methods

__construct()

__construct(array  $config) 

Universal constructor

設定を_configプロパティに代入します。

Parameters

array $config

ユーザー設定値

onInject()

onInject() : void

Inject

設定にしたがってサービスをインジェクトします。

setConfig()

setConfig(mixed  $config, mixed  $values = null) : self

Set config

Parameters

mixed $config

(string) 設定キー | (array) 設定配列

mixed $values

(string) $configの時の設定値

Returns

self

getConfig()

getConfig(string  $key = null) : mixed

Get config

Parameters

string $key

設定キー、指定なければ全ての設定を取得

Returns

mixed

setService()

setService(string  $name, mixed  $service) : void

Set service

Parameters

string $name

サービスキー

mixed $service

サービス

start()

start(integer  $port = 103754, boolean  $isFork = true, string  $handlerName = 'BEAR_Resource_Server_Handler', boolean  $ipAddress = false) : void

サービススタート

Parameters

integer $port

ポート番号

boolean $isFork

サーバータイプ true:folk false:sequential

string $handlerName

サーバーハンドラ名

boolean $ipAddress

サーバーIP

_exception()

_exception(string  $msg, array  $config = array()) : \BEAR_Exception

例外の作成

Parameters

string $msg

例外メッセージ

array $config

例外config

Returns

\BEAR_Exception

_printStartUpinfo()

_printStartUpinfo(string  $ipAddress, string  $type) : void

スタートアップメッセージ表示

Parameters

string $ipAddress

IPアドレス

string $type

サーバータイプ