CONTENTS

NAME

Mojo::IOLoop::Stream::WebSocketClient - Non-blocking I/O WebSocket client stream

SYNOPSIS

use Mojo::IOLoop::Stream::WebSocketClient;
use Mojo::Transaction::WebSocket;

# Create transaction
my $ws = Mojo::Transaction::WebSocket->new;
$ws->on(message => sub {
  my ($ws, $msg) = @_;
  say "Message: $msg";
});

# Create stream and process transaction with it
my $stream = Mojo::IOLoop::Stream::WebSocketClient->new($handle);
$stream->process($ws);

# Start reactor if necessary
$stream->reactor->start unless $stream->reactor->is_running;

DESCRIPTION

Mojo::IOLoop::Stream::WebSocketClient is a container for I/O streams used by Mojo::IOLoop to support the WebSocket protocol client-side.

EVENTS

Mojo::IOLoop::Stream::WebSocketClient inherits all events from Mojo::IOLoop::Stream::HTTPClient.

ATTRIBUTES

Mojo::IOLoop::Stream::WebSocketClient inherits all attributes from Mojo::IOLoop::Stream::HTTPClient.

METHODS

Mojo::IOLoop::Stream::WebSocketClient inherits all methods from Mojo::IOLoop::Stream::HTTPClient and implements the following new ones.

process

$stream->process(Mojo::Transaction::WebSocket->new);

Process a Mojo::Transaction::WebSocket object.

SEE ALSO

Mojolicious, Mojolicious::Guides, http://mojolicious.org.