renamed the acme to mineseeker && handle when the user connection has been lost
This commit is contained in:
@@ -7,7 +7,7 @@ use Gos\Bundle\WebSocketBundle\Event\ClientErrorEvent;
|
||||
use Gos\Bundle\WebSocketBundle\Event\ServerEvent;
|
||||
use Gos\Bundle\WebSocketBundle\Event\ClientRejectedEvent;
|
||||
|
||||
class AcmeClientEventListener
|
||||
class MineseekerClientEventListener
|
||||
{
|
||||
/**
|
||||
* Called whenever a client connects
|
||||
@@ -1,17 +1,17 @@
|
||||
# Topic Configuration
|
||||
acme_topic:
|
||||
channel: acme/channel/{game}
|
||||
mineseeker_topic:
|
||||
channel: mineseeker/channel/{game}
|
||||
handler:
|
||||
callback: 'acme.topic' #related to the getName() of your topic
|
||||
callback: 'mineseeker.topic' #related to the getName() of your topic
|
||||
# requirements:
|
||||
# method:
|
||||
# path: '[a-z1-9A-Z]+'
|
||||
|
||||
# Remote Procedure Call Configuration
|
||||
acme_rpc:
|
||||
channel: sample/{method}
|
||||
mineseeker_rpc:
|
||||
channel: mineseeker-rpc/{method}
|
||||
handler:
|
||||
callback: 'acme.rpc' #related to the getName() or your RPC service
|
||||
callback: 'mineseeker.rpc' #related to the getName() or your RPC service
|
||||
requirements:
|
||||
method:
|
||||
path: "[a-z_]+"
|
||||
|
||||
@@ -26,8 +26,8 @@ services:
|
||||
arguments:
|
||||
- "@doctrine_cache.providers.doctrine.orm.default_result_cache"
|
||||
|
||||
acme_hello.topic_sample_service:
|
||||
class: Mine\SeekerBundle\Topic\AcmeTopic
|
||||
mineseeker.topic_sample_service:
|
||||
class: Mine\SeekerBundle\Topic\MineseekerTopic
|
||||
tags:
|
||||
- { name: gos_web_socket.topic }
|
||||
arguments:
|
||||
@@ -35,15 +35,15 @@ services:
|
||||
doctrine: '@doctrine.orm.entity_manager'
|
||||
requestStack: '@request_stack'
|
||||
|
||||
acme_hello.rpc_sample_service:
|
||||
class: Mine\SeekerBundle\Rpc\AcmeRpc
|
||||
mineseeker.rpc_sample_service:
|
||||
class: Mine\SeekerBundle\Rpc\MineseekerRpc
|
||||
tags:
|
||||
- { name: gos_web_socket.rpc }
|
||||
arguments:
|
||||
doctrine: '@doctrine.orm.entity_manager'
|
||||
|
||||
gos_web_socket_server.client_event.listener:
|
||||
class: Mine\SeekerBundle\EventListener\AcmeClientEventListener
|
||||
class: Mine\SeekerBundle\EventListener\MineseekerClientEventListener
|
||||
tags:
|
||||
- { name: kernel.event_listener, event: 'gos_web_socket.client_connected', method: onClientConnect }
|
||||
- { name: kernel.event_listener, event: 'gos_web_socket.client_disconnected', method: onClientDisconnect }
|
||||
|
||||
@@ -7,7 +7,7 @@ class MineSeeker extends React.Component {
|
||||
super(props);
|
||||
|
||||
var gameAssoc = props.gameId !== '' ? props.gameId : this.makeGameAssoc(50);
|
||||
var channel = "acme/channel/" + gameAssoc;
|
||||
var channel = "mineseeker/channel/" + gameAssoc;
|
||||
|
||||
this.state = {
|
||||
gameInherited: props.gameId !== '',
|
||||
@@ -50,7 +50,7 @@ class MineSeeker extends React.Component {
|
||||
*/
|
||||
session
|
||||
.call(
|
||||
this.state.gameInherited ? "sample/connectGame" : "sample/startGame",
|
||||
this.state.gameInherited ? "mineseeker-rpc/connectGame" : "mineseeker-rpc/startGame",
|
||||
this.state.gameInherited ? this.state.gameAssoc : [Base64.encode(JSON.stringify(gridClient)), this.state.gameAssoc]
|
||||
)
|
||||
.then(
|
||||
@@ -115,6 +115,12 @@ class MineSeeker extends React.Component {
|
||||
});
|
||||
} else {
|
||||
console.info(payload.msg);
|
||||
|
||||
this.refs.gridControl.setState({
|
||||
overlay: true,
|
||||
overlayTitle: "The connection has been lost...",
|
||||
overlaySubTitle: "Please, restart the game!"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use Ratchet\ConnectionInterface;
|
||||
use Gos\Bundle\WebSocketBundle\RPC\RpcInterface;
|
||||
use Gos\Bundle\WebSocketBundle\Router\WampRequest;
|
||||
|
||||
class AcmeRpc implements RpcInterface
|
||||
class MineseekerRpc implements RpcInterface
|
||||
{
|
||||
/**
|
||||
* @var EntityManager
|
||||
@@ -21,7 +21,7 @@ class AcmeRpc implements RpcInterface
|
||||
protected $grid;
|
||||
|
||||
/**
|
||||
* AcmeRpc constructor.
|
||||
* MineseekerRpc constructor.
|
||||
* @param EntityManager $entityManager
|
||||
*/
|
||||
public function __construct(EntityManager $entityManager)
|
||||
@@ -36,7 +36,7 @@ class AcmeRpc implements RpcInterface
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'acme.rpc';
|
||||
return 'mineseeker.rpc';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,7 @@ use Ratchet\ConnectionInterface;
|
||||
use Ratchet\Wamp\Topic;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
class AcmeTopic implements TopicInterface
|
||||
class MineseekerTopic implements TopicInterface
|
||||
{
|
||||
/** @var ClientManipulatorInterface */
|
||||
protected $clientManipulator;
|
||||
@@ -24,7 +24,7 @@ class AcmeTopic implements TopicInterface
|
||||
protected $requestStack;
|
||||
|
||||
/**
|
||||
* AcmeTopic constructor.
|
||||
* MineseekerTopic constructor.
|
||||
*
|
||||
* @param $clientManipulator ClientManipulatorInterface
|
||||
* @param EntityManager $entityManager
|
||||
@@ -114,7 +114,7 @@ class AcmeTopic implements TopicInterface
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'acme.topic';
|
||||
return 'mineseeker.topic';
|
||||
}
|
||||
|
||||
private function saveUserToDb($topic, $userName, $user, $count)
|
||||
Reference in New Issue
Block a user