xp-forge / xp-forge/web

Ability to select on an additional socket

Open
#127 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

...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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the listener handling and socket registration represented by Listeners::add in the issue example, then compare it with the linked websocket and Feed examples. Clarify how an additional socket should coexist with the existing listeners; done means a Redis-backed socket can be selected and used to broadcast messages alongside the web connections.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.