Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Oct 23, 2024
1 parent f7cdc63 commit 8118a32
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test": "./vendor/bin/phpunit tests/ --verbose --coverage-clover=coverage.clover"
},
"require": {
"php": "^7.4|>=8.0",
"php": ">=8.0",
"rmccue/requests": "^2.0",
"psr/log": "^1.1|^2.0|^3.0"
},
Expand Down
18 changes: 18 additions & 0 deletions src/PubNub/Endpoints/PubSub/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ final class Publish extends Endpoint
/** @var bool $usePost HTTP method instead of default GET */
protected $usePost;

/** @var string $customMessageType User defined message type */
protected ?string $customMessageType;

/** @var array $meta data */
protected $meta;

Expand Down Expand Up @@ -93,6 +96,17 @@ public function usePost($usePost)
return $this;
}

/**
* @param string $customMessageType
* @return $this
*/
public function customMessageType(?string $customMessageType)
{
$this->customMessageType = $customMessageType;

return $this;
}

/**
* @param array $meta
* @return $this
Expand Down Expand Up @@ -166,6 +180,10 @@ protected function customParams()
$params['ttl'] = (string) $this->ttl;
}

if (isset($this->customMessageType)) {
$params['custom_message_type'] = $this->customMessageType;
}

$params['seqn'] = $this->pubnub->getSequenceId();

if (!$this->replicate) {
Expand Down

0 comments on commit 8118a32

Please sign in to comment.