Skip to content
Snippets Groups Projects
Verified Commit e85b66fa authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Cleanup

parent 71db51a2
Branches
No related tags found
No related merge requests found
......@@ -91,7 +91,6 @@ sub startup {
my $r = $self->routes;
$r->get('/')->to(cb => sub { shift->redirect_to('/api.html');});
$r->websocket('/ws/posts')->to('Posts#ws');
$r->websocket('/ws')->to('Websockets#main');
}
......
......@@ -180,15 +180,6 @@ sub update ($c) {
changed => \'now()',
});
# TODO: vyhodit
$pubsub->json('posts')->notify( posts => {
event => 'changed',
payload => {
id => $post->id,
%{ $update },
}
});
$pubsub->json('notify')->notify( notify => {
event => 'post_changed',
payload => {
......@@ -254,15 +245,6 @@ sub ranking ($c) {
});
}
# TODO: vyhodit
$pubsub->json('posts')->notify(posts => {
event => 'ranked',
payload => {
id => $post->id,
%{ $update },
}
});
$pubsub->json('notify')->notify(notify => {
event => 'post_ranked',
payload => {
......@@ -275,22 +257,4 @@ sub ranking ($c) {
$c->render(status => 204, text => '');
}
# TODO: vyhodit
sub ws {
my $c = shift;
$c->inactivity_timeout(600);
my $pubsub = Mojo::Pg::PubSub->new(pg => $c->pg);
$pubsub->listen(posts => sub($pubsub, $payload) {
$c->send($payload);
});
$c->on(finish => sub ($c, $code, $reason = undef) {
$pubsub->unlisten('streams');
$c->app->log->debug("WebSocket closed with status $code");
});
}
1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment