Skip to content
Snippets Groups Projects
Commit 68e309ec authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Slight code refactoring & _stop event

parent bb5c59dd
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,9 @@ sub plugin_init
# This is our session handling sending data to connections
POE::Session->create(
inline_states => {
_start => \&session_init,
_start => \&session_start,
_stop => \&session_stop,
'websocket.send' => \&do_send,
}
);
......@@ -102,9 +104,9 @@ sub plugin_init
# Session initialization
sub session_init
sub session_start
{
my $kernel = $_[KERNEL];
my ($kernel,$heap) = @_[KERNEL,HEAP];
# Set our alias
$kernel->alias_set("plugin.webserver.websockets.statistics");
......@@ -113,6 +115,25 @@ sub session_init
}
# Session stop
sub session_stop
{
my ($kernel,$heap) = @_[KERNEL,HEAP];
# Remove our alias
$kernel->alias_remove("plugin.webserver.websockets.statistics");
# Destroy data
$globals = undef;
$cSubscriptions = {};
$uSubscriptions = {};
$logger->log(LOG_DEBUG,"[WEBSERVER] Snapin/WebSockets/Statistics - Shutdown");
$logger = undef;
}
# Send data to client
sub do_send
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment