NAME

Beekeeper::Service::Router - Route messages between backend and frontend buses

VERSION

Version 0.05

SYNOPSIS

$self->bind_remote_session( address => "frontend.user-123" );

$self->send_notification(
    method  => 'myapp.private_message',
    address => 'frontend.user-123',
    params  => 'hello',
);

$self->unbind_remote_session;

$self->unbind_remote_address( address => "frontend.user-123" );

DESCRIPTION

Router workers shovel requests messages between frontend and backend brokers.

Additionally, routers include some primitives that can be used to implement session management and push notifications.

If the application does not bind client sessions the routers can scale really well, as you can have a lot of them in a large number of servers.

But please note that when the application does use the session binding mechanism all routers will need to share an address table, and this shared table will not scale as well as the rest of the system. So a better strategy (some kind of partition) will be needed for applications with a large number of concurrent clients.

METHODS

bind_remote_session ( address => $address )

Make authorization data persist for remote caller session and optionally assign an arbitrary address to the remote client.

The authorization data can be used to store a session ID or other tokens which identify requests as coming from a particular remote client.

If an address is provided it can be used to push notifications to the client. The same address can be assigned to multiple remote clients, and all of them will receive the notifications sent to it. This is intended to allow to push notifications to users logged into multiple devices.

unbind_remote_session

Clear the authorization data and address assignment of a single remote caller session.

This does not affect other remote clients which share the same address. This is intended to implement "logout from this device" functionality.

unbind_remote_address ( address => $address )

Clear the authorization data and address assignment of all remote clients which were assigned the given address.

This is intended to implement "logout from all devices" functionality.

SEE ALSO

Beekeeper::Service::Router::Worker

AUTHOR

José Micó, jose.mico@gmail.com

COPYRIGHT AND LICENSE

Copyright 2015-2021 José Micó.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.

This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.