UniEvent::WebSocket::ConnectRequest - Request for connect for websocket client
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 });
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.
UniEvent::WebSocket::ConnectRequest
Most of websocket params are inherited and described in Protocol::WebSocket::Fast::ConnectRequest.
Http params are documented in Protocol::HTTP::Request
Params is a hashref with the following keys:
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()
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.
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 for the whole connection process (till the end of websocket handshake) in seconds (may be fractional).
See Protocol::WebSocket::Fast::ConnectRequest, Protocol::HTTP::Request
To install UniEvent::WebSocket, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UniEvent::WebSocket
CPAN shell
perl -MCPAN -e shell install UniEvent::WebSocket
For more information on module installation, please visit the detailed CPAN module installation guide.