The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

UniEvent::WebSocket::ConnectRequest - Request for connect for websocket client

SYNOPSIS

    my $req = UniEvent::WebSocket::ConnectRequest->new({
        
    });
    
    my $client = UniEvent::WebSocket::Client->new;
    $client->connect($req);
    $client->connect_callback(sub {
        ...
    });

    # can also be created indirectly
    $client->connect({
        # ... request constructor params
    });

DESCRIPTION

UniEvent::WebSocket::ConnectRequest is used to connect websocket client to server. It's a storage for a variety of websocket connection params. It is inherited from Protocol::WebSocket::Fast::ConnectRequest (and therefore from Protocol::HTTP::Request) so their API also applies. You may add any http headers and tune other http request params as well.

Most of websocket params are inherited and described in Protocol::WebSocket::Fast::ConnectRequest.

Http params are documented in Protocol::HTTP::Request

METHODS

new(\%params)

Params is a hashref with the following keys:

addr_hints

AddrInfo hints for resolving domain names during connection process.

addr_hints should be either a binary string created via UniEvent::Resolver::hints()

    addr_hints => UniEvent::Resolver::hints(AF_INET, SOCK_STREAM, PF_INET),
    
    Or a hashref with the corresponding info

    addr_hints => {
        family   => AF_INET,
        socktype => SOCK_STREAM,
        protocol => PF_INET,
        flags    => 0,
    },
    

See UniEvent::Resolver for more info.

cached_resolver [=true]

If true, will use cached resolver for resolving domain names (will use the result of previous resolving process with the same host/port/hints/etc and will do real resolving only from time to time).

timeout [unlimited]

Timeout for the whole connection process (till the end of websocket handshake) in seconds (may be fractional).

Everything that Protocol::WebSocket::Fast::ConnectRequest and Protocol::HTTP::Request supports

See Protocol::WebSocket::Fast::ConnectRequest, Protocol::HTTP::Request