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