Skip to content

Ability to select on an additional socket #127

@thekid

Description

@thekid

...like in https://github.com/xp-forge/websockets:

use io\redis\RedisProtocol;
use websocket\{Listener, Listeners};

class Example extends Listeners {

  public function serve($listeners) {
    $dsn= ...;
    $queue= ...;

    // Subscribe to the Redis queue and handle 
    $protocol= new RedisProtocol($dsn);
    $protocol->command('SUBSCRIBE', $queue);
    $listeners->add($protocol->socket(), function($protocol) {
      $message= $protocol->receive();
      // ...shortened for brevity...
    });
  }

  return function($conn, $payload) { /* ... */ };
}

This would make it possible to broadcast messages as seen here: https://github.com/thekid/crews/blob/main/src/main/php/de/thekid/crews/Feed.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions