ConnectionsManager

io.github.positionpal.location.ws.handlers.v1.ConnectionsManager

A thread-safe web sockets connections manager that is responsible for keeping track of the active connections for each group.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Types

type Connection = (UserId, ActorRef[DrivenEvent])

A tuple of the user id and the reference to the actor in charge of managing the web socket connection.

A tuple of the user id and the reference to the actor in charge of managing the web socket connection.

Attributes

Value members

Concrete methods

def activeConnectionsFor(groupId: GroupId): Set[Connection]

Attributes

Returns

the active connections for the given groupId.

def addConnection(groupId: GroupId, userId: UserId, actorRef: ActorRef[DrivenEvent]): Set[Connection]

Adds a new connection to the givne groupId performed by the given userId (managed by the actorRef).

Adds a new connection to the givne groupId performed by the given userId (managed by the actorRef).

Attributes

Returns

the old active connections for the given groupId.

def removeConnection(groupId: GroupId, userId: UserId): Set[Connection]

Removes the connection for the given userId in the given groupId.

Removes the connection for the given userId in the given groupId.

Attributes

Returns

the old active connections for the given groupId.