From c642e97155f29916aa005be07f4f86676136d0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Mon, 21 Feb 2022 23:48:52 +0100 Subject: [PATCH] golang online counter --- lib/CF/Controller/Websockets.pm | 12 ++++++------ openapi.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/CF/Controller/Websockets.pm b/lib/CF/Controller/Websockets.pm index 6372c18..cbabd5d 100644 --- a/lib/CF/Controller/Websockets.pm +++ b/lib/CF/Controller/Websockets.pm @@ -26,15 +26,15 @@ sub main { my $listener_online = $pubsub->listen('online:0' => sub($pubsub, $payload) { #TODO: event_id my @counts = split ' ', $payload; - $c->send(json => { + $c->send({json => { event => 'online_users_updated', payload => { - all => $counts[0], - members => $counts[1], - group_size_full => $counts[2], - group_size_half => $counts[3], + all => $counts[0]+0, + members => $counts[1]+0, + group_size_full => $counts[2]+0, + group_size_half => $counts[3]+0, } - }); + }}); }); $c->on(json => sub( $c, $message ) { diff --git a/openapi.yaml b/openapi.yaml index 4ae6b28..406655b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.3 info: - version: "3.1.1" + version: "3.1.2" title: CF Online description: CF Online license: -- GitLab