++ed by:
FUKAI ZAKAME JIPIPAYO MIKEGRB DATA

163 PAUSE users
213 non-PAUSE users.

Sebastian Riedel

NAME

Mojo::IOLoop::Stream::WebSocketServer - Non-blocking I/O WebSocket server stream

SYNOPSIS

  use Mojo::IOLoop::Stream::WebSocketServer;
  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::WebSocketServer->new($handle);
  $stream->process($ws);

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

DESCRIPTION

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

EVENTS

Mojo::IOLoop::Stream::WEBSocketServer inherits all events from Mojo::IOLoop::Stream::HTTPServer.

ATTRIBUTES

Mojo::IOLoop::Stream::WebSocketServer inherits all attributes from Mojo::IOLoop::Stream::HTTPServer.

METHODS

Mojo::IOLoop::Stream::WebSocketServer inherits all methods from Mojo::IOLoop::Stream::HTTPServer 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.