Skip to content

Commit

Permalink
Prepare version 1.2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaillard committed Aug 22, 2016
1 parent 0b3e77e commit bd10a5b
Show file tree
Hide file tree
Showing 12 changed files with 351 additions and 87 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ module.exports = function(grunt) {
command += '--stop-on-failure ';
command += '--verbose ';
command += '--debug ';
// command += '--group TagsTreeTest.testFindByTags ';
//command += '--group WebSocketClientMockTest.testFindByTags ';
command += 'src/test/php';

return command;
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ To help you start quickly we also provide a Docker container here https://hub.do

## Release history

### 1.2.0 (2016-08-23)
* Moves the `TagsTree` class to `\Gomoob\WebSocket\Util\TagsTree` ;
* Add a new `TagsTree->reset()` method ;
* Add a new `\Gomoob\WebSocket\Client\WebSocketClientMock` class to easier unit testing ;
* Update composer dependencies.

### 1.1.0 (2016-08-18)
* Add more PHP Documentor documentation about the goals of `metadata` in
the `\Gomoob\WebSocket\IWebSocketRequest` interface and the
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name" : "gomoob/php-websocket-server",
"description" : "WebSocket server with tags management, forward your messages on the right clients with ease !",
"version" : "1.1.0",
"version" : "1.2.0",
"license" : "MIT",
"minimum-stability" : "stable",
"prefer-stable" : true,
Expand Down
34 changes: 15 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fatcap-web-sockets",
"version": "1.1.0",
"version": "1.2.0",
"repository": {
"type": "git",
"url": "git://bitbucket.org/gomoob/fatcap-web-sockets.git"
Expand Down
78 changes: 78 additions & 0 deletions src/main/php/Gomoob/WebSocket/Client/AbstractWebSocketClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

/**
* gomoob/php-websocket-server
*
* @copyright Copyright (c) 2016, GOMOOB SARL (http://gomoob.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE.md file)
*/
namespace Gomoob\WebSocket\Client;

use Gomoob\WebSocket\IWebSocketClient;

/**
* Abstract class common to all WebSocket clients.
*
* @author GOMOOB SARL (contact@gomoob.com)
*/
abstract class AbstractWebSocketClient implements IWebSocketClient
{
/**
* Default metadata to set on all requests sent with the client, those metadata will be merged with the
* metadata specified on the requests.
*
* **WARNING** If a metadata property specifically defined on a request has the same name as a default metadata
* property defined on the WebSocket client then the metadata property defined with the request
* overwrites the default metadata property.
*
* @var array
*/
protected $defaultMetadata = [];

/**
* Default tags to set on all requests sent with the client, those tags will be merged with the tags specified on
* the requests.
*
* **WARNING** If a tag property specifically defined on a request has the same name as a default tag
* property defined on the WebSocket client then the tag property defined with the request
* overwrites the default tag property.
* @var array
*/
protected $defaultTags = [];

/**
* {@inheritDoc}
*/
public function getDefaultMetadata()
{
return $this->defaultMetadata;
}

/**
* {@inheritDoc}
*/
public function getDefaultTags()
{
return $this->defaultTags;
}

/**
* {@inheritDoc}
*/
public function setDefaultMetadata(array $defaultMetadata = [])
{
$this->defaultMetadata = $defaultMetadata;

return $this;
}

/**
* {@inheritDoc}
*/
public function setDefaultTags(array $defaultTags = [])
{
$this->defaultTags = $defaultTags;

return $this;
}
}
62 changes: 1 addition & 61 deletions src/main/php/Gomoob/WebSocket/Client/WebSocketClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
namespace Gomoob\WebSocket\Client;

use Gomoob\WebSocket\IWebSocketClient;
use Gomoob\WebSocket\IWebSocketRequest;

use WebSocket\Client;
Expand All @@ -18,7 +17,7 @@
*
* @author GOMOOB SARL (contact@gomoob.com)
*/
class WebSocketClient implements IWebSocketClient
class WebSocketClient extends AbstractWebSocketClient
{
/**
* The Textalk WebSocket client used to send messages.
Expand All @@ -27,29 +26,6 @@ class WebSocketClient implements IWebSocketClient
*/
protected $client;

/**
* Default metadata to set on all requests sent with the client, those metadata will be merged with the
* metadata specified on the requests.
*
* **WARNING** If a metadata property specifically defined on a request has the same name as a default metadata
* property defined on the WebSocket client then the metadata property defined with the request
* overwrites the default metadata property.
*
* @var array
*/
protected $defaultMetadata = [];

/**
* Default tags to set on all requests sent with the client, those tags will be merged with the tags specified on
* the requests.
*
* **WARNING** If a tag property specifically defined on a request has the same name as a default tag
* property defined on the WebSocket client then the tag property defined with the request
* overwrites the default tag property.
* @var array
*/
protected $defaultTags = [];

/**
* Creates a new instance of the Gomoob Web Socket client.
*
Expand All @@ -60,22 +36,6 @@ public function __construct($uri)
$this->client = new Client($uri);
}

/**
* {@inheritDoc}
*/
public function getDefaultMetadata()
{
return $this->defaultMetadata;
}

/**
* {@inheritDoc}
*/
public function getDefaultTags()
{
return $this->defaultTags;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -108,24 +68,4 @@ public function send(IWebSocketRequest $webSocketRequest)
// Sends the request
$this->client->send(json_encode($clonedWebSocketRequest));
}

/**
* {@inheritDoc}
*/
public function setDefaultMetadata(array $defaultMetadata = [])
{
$this->defaultMetadata = $defaultMetadata;

return $this;
}

/**
* {@inheritDoc}
*/
public function setDefaultTags(array $defaultTags = [])
{
$this->defaultTags = $defaultTags;

return $this;
}
}
Loading

0 comments on commit bd10a5b

Please sign in to comment.