💾 Archived View for yggverse.cities.yesterweb.org › nps › nps-php › 1.3.0.gmi captured on 2024-05-12 at 15:11:56. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
Define application logic on peer connection established
$server->setWelcome( function ( string $connect ): ?string { printf( "connected: %s\n\r", $connect ); return sprintf( "welcome, %s\n\r", $connect ); } );
Get current Welcome function, null by default
Define application logic on peer make initial request
$server->setPending( function ( string $request, string $connect ): ?string { printf( 'connection: %s requested: %s', $connect, $request, ); return sprintf( 'received: %s', $request ); } );
Get current Pending function, null by default
Define basic application logic on complete packet received
$server->setHandler( function ( bool $success, string $content, string $request, string $connect ): ?string { printf( 'connection: %s request: %s', $connect, $request ); if ($success) { var_dump( $content ); } return 'thank you!'; } );
Get current Handler function, null by default
$server->start();
> nc 127.0.0.1 1915 < welcome, 127.0.0.1:38028 > test < received: test > 1 > 2 > 3 > . < thank you!