working websocket client and server w/o session handling and storage
This commit is contained in:
35
src/Mine/SeekerBundle/Rpc/AcmeRpc.php
Normal file
35
src/Mine/SeekerBundle/Rpc/AcmeRpc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Mine\SeekerBundle\Rpc;
|
||||
|
||||
use Ratchet\ConnectionInterface;
|
||||
use Gos\Bundle\WebSocketBundle\RPC\RpcInterface;
|
||||
use Gos\Bundle\WebSocketBundle\Router\WampRequest;
|
||||
|
||||
class AcmeRpc implements RpcInterface
|
||||
{
|
||||
/**
|
||||
* Adds the params together
|
||||
*
|
||||
* Note: $conn isnt used here, but contains the connection of the person making this request.
|
||||
*
|
||||
* @param ConnectionInterface $connection
|
||||
* @param WampRequest $request
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function addFunc(ConnectionInterface $connection, WampRequest $request, $params)
|
||||
{
|
||||
return array("result" => array_sum($params));
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of RPC, use for pubsub router (see step3)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'acme.rpc';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user