NAME

Terse::WebSocket - Lightweight WebSockets

VERSION

Version 0.15

SYNOPSIS

package Chat;

use base 'Terse';

sub auth {
	my ($self, $t, $session) = @_;
	return 0 if $t->params->not;
	return $session;
}

sub chat {
	my ($self, $t) = @_;
	$self->webchat->{$t->sid->value} = $t->websocket(
		connect => sub {
			my ($websocket) = @_;
			$websocket->send('Hello');
		},
		recieve => sub {
			my ($websocket, $message) = @_;

			$websocket->send($message); # echo
		},
		error => sub { ... },
		disconnect => sub { ... }
	);
}

1;

plackup -s Starman Chat.psgi

CONNECT ws://localhost:5000?req=chat;

AUTHOR

LNATION, <email at lnation.org>

LICENSE AND COPYRIGHT

Terse.