Closed elovin closed 4 years ago
If you want to accept any connection and do the authentication after the handshake instead of within the handshake, you can use handleClient
directly and just return new Success($response)
in handleHandshake
. In handleClient
you have both the Client
and the other client object as part of Request
available.
Im trying to disconnect clients who did not send a valid message after 5 Seconds (the authorization is done with the first message send by the client, in case the message has never been send I want to disconnect the client), for this I use a delay within the
handleHandshake
method. So far this works just fine but it seems there is no way to get the websocket client (\Amp\Websocket\Client
) belonging to the resource client (\Amp\Http\Server\Driver\Client
) which is the only information I have during the handshake.I think it would be useful If the endpoint had a method to get the websocket client belonging to the resource client e.g. something like this (I know this will not work if its used directly within the handshake method but after the delay the websocket client should exist):
$endpoint->getClientByResourceId($request->getClient()->getId());
Example handshake and delay method: