Skip to content

Commit

Permalink
Merge pull request #20: Add Ping/Pong flags
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Oct 3, 2023
2 parents 3f6dc5e + f8df7b0 commit d955f58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/BlockingRelayInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Spiral\Goridge;

/**
* Means that relay can't be used for non-blocking flow.
*/
interface BlockingRelayInterface extends RelayInterface
{
}
6 changes: 4 additions & 2 deletions src/Frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ final class Frame
* @var positive-int Flags for {@see $byte10}
*/
public const BYTE10_STREAM = 0x01;
public const BYTE10_STOP = 0x02; // 2.9.0-alpha just streams
public const BYTE10_STOP = 0x02;
public const BYTE10_PING = 0x04;
public const BYTE10_PONG = 0x08;

/**
* @psalm-var FrameByte10Value
Expand Down Expand Up @@ -124,7 +126,7 @@ public static function packFrame(Frame $frame): string
* @return HeaderList
* @internal
*
* @psalm-suppress InvalidReturnStatement, InvalidReturnType
* @psalm-suppress LessSpecificReturnStatement, MoreSpecificReturnType
*/
public static function readHeader(string $header): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/StreamRelay.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* prefix:
* [ flag ][ message length, unsigned int 64bits, LittleEndian ]
*/
class StreamRelay extends Relay
class StreamRelay extends Relay implements BlockingRelayInterface
{
/**
* @var resource
Expand Down

0 comments on commit d955f58

Please sign in to comment.