diff --git a/package.json b/package.json
index e633892..cbcb539 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"howler": "^2.0.1",
+ "js-base64": "^2.1.9",
"react": "^15.3.2",
"react-dom": "^15.3.2"
},
diff --git a/src/Mine/SeekerBundle/Resources/public/js/mine-seeker/app.js b/src/Mine/SeekerBundle/Resources/public/js/mine-seeker/app.js
index f87ced3..d0d6a69 100644
--- a/src/Mine/SeekerBundle/Resources/public/js/mine-seeker/app.js
+++ b/src/Mine/SeekerBundle/Resources/public/js/mine-seeker/app.js
@@ -53,7 +53,7 @@ class MineSeeker extends React.Component {
session
.call(
this.state.gameInherited ? "sample/connectGame" : "sample/startGame",
- this.state.gameInherited ? this.state.gameAssoc : [gridClient, this.state.gameAssoc]
+ this.state.gameInherited ? this.state.gameAssoc : [Base64.encode(JSON.stringify(gridClient)), this.state.gameAssoc]
)
.then(
(gridServer) => {
@@ -63,7 +63,7 @@ class MineSeeker extends React.Component {
/** save session to GridControl */
this.refs.gridControl.setState({
- grid: this.state.gameInherited ? JSON.parse(gridServer) : gridClient,
+ grid: this.state.gameInherited ? JSON.parse(Base64.decode(gridServer)) : gridClient,
session: this.state.session,
channel: this.state.channel
});
diff --git a/src/Mine/SeekerBundle/Resources/views/Game/play.html.twig b/src/Mine/SeekerBundle/Resources/views/Game/play.html.twig
index ac0027c..099bfb6 100644
--- a/src/Mine/SeekerBundle/Resources/views/Game/play.html.twig
+++ b/src/Mine/SeekerBundle/Resources/views/Game/play.html.twig
@@ -20,5 +20,6 @@
{{ ws_client() }}
+
{% endblock %}
diff --git a/src/Mine/SeekerBundle/Rpc/AcmeRpc.php b/src/Mine/SeekerBundle/Rpc/AcmeRpc.php
index cf85e8f..015a050 100644
--- a/src/Mine/SeekerBundle/Rpc/AcmeRpc.php
+++ b/src/Mine/SeekerBundle/Rpc/AcmeRpc.php
@@ -43,7 +43,7 @@ class AcmeRpc implements RpcInterface
* @param ConnectionInterface $connection
* @param WampRequest $request
* @param array $params
- * @return Grid
+ * @return boolean
*/
public function startGame(ConnectionInterface $connection, WampRequest $request, array $params)
{
@@ -58,7 +58,7 @@ class AcmeRpc implements RpcInterface
*/
public function connectGame(ConnectionInterface $connection, WampRequest $request, array $params)
{
- return json_encode($this->getGrid($params), JSON_NUMERIC_CHECK);
+ return base64_encode(json_encode($this->getGrid($params), JSON_NUMERIC_CHECK));
}
/**
@@ -91,14 +91,14 @@ class AcmeRpc implements RpcInterface
/**
* @param $data
- * @return Grid
+ * @return boolean
*/
private function saveGrid($data)
{
$playedGame = new PlayedGame();
$grid = new Grid();
- foreach ($data[0] as $row) {
+ foreach (json_decode(base64_decode($data[0])) as $row) {
$gridRow = new GridRow();
foreach ($row as $col) {