Liking cljdoc? Tell your friends :D

boundary.realtime.core.connection

Pure functions for WebSocket connection state management.

Following FC/IS pattern - all functions are pure (no I/O). Connection lifecycle and authorization logic.

Pure functions for WebSocket connection state management.

Following FC/IS pattern - all functions are pure (no I/O).
Connection lifecycle and authorization logic.
raw docstring

assoc-metadataclj

(assoc-metadata connection k v)

Associate key-value pair in connection metadata.

Pure function - returns new connection.

Args: connection - Connection record k - Metadata key v - Metadata value

Returns: New Connection record with updated metadata

Associate key-value pair in connection metadata.

Pure function - returns new connection.

Args:
  connection - Connection record
  k - Metadata key
  v - Metadata value

Returns:
  New Connection record with updated metadata
sourceraw docstring

authorize-connection-all?clj

(authorize-connection-all? connection required-roles)

Check if connection has all required roles.

Pure function - no side effects.

Args: connection - Connection record required-roles - Set of role keywords

Returns: Boolean - true if connection has all roles

Check if connection has all required roles.

Pure function - no side effects.

Args:
  connection - Connection record
  required-roles - Set of role keywords

Returns:
  Boolean - true if connection has all roles
sourceraw docstring

authorize-connection-any?clj

(authorize-connection-any? connection required-roles)

Check if connection has any of the required roles.

Pure function - no side effects.

Args: connection - Connection record required-roles - Set of role keywords

Returns: Boolean - true if connection has at least one role

Check if connection has any of the required roles.

Pure function - no side effects.

Args:
  connection - Connection record
  required-roles - Set of role keywords

Returns:
  Boolean - true if connection has at least one role
sourceraw docstring

authorize-connection?clj

(authorize-connection? connection required-role)

Check if connection has required role.

Pure function - no side effects.

Args: connection - Connection record required-role - Role keyword required

Returns: Boolean - true if connection has role

Check if connection has required role.

Pure function - no side effects.

Args:
  connection - Connection record
  required-role - Role keyword required

Returns:
  Boolean - true if connection has role
sourceraw docstring

connection-ageclj

(connection-age connection now)

Calculate connection age in seconds.

Pure function - deterministic for given inputs.

Args: connection - Connection record now - Current instant (for testability)

Returns: Age in seconds

Calculate connection age in seconds.

Pure function - deterministic for given inputs.

Args:
  connection - Connection record
  now - Current instant (for testability)

Returns:
  Age in seconds
sourceraw docstring

create-connectionclj

(create-connection user-id roles id now)
(create-connection user-id roles metadata id now)

Create new connection record.

Pure function - deterministic for given inputs.

Args: user-id - UUID of authenticated user roles - Set of user roles (keywords) metadata - Optional metadata map (default: {}) id - Connection UUID generated by shell layer now - Current timestamp generated by shell layer

Returns: Connection record

Create new connection record.

Pure function - deterministic for given inputs.

 Args:
  user-id - UUID of authenticated user
  roles - Set of user roles (keywords)
  metadata - Optional metadata map (default: {})
  id - Connection UUID generated by shell layer
  now - Current timestamp generated by shell layer

Returns:
  Connection record
sourceraw docstring

dissoc-metadataclj

(dissoc-metadata connection k)

Dissociate key from connection metadata.

Pure function - returns new connection.

Args: connection - Connection record k - Metadata key to remove

Returns: New Connection record with updated metadata

Dissociate key from connection metadata.

Pure function - returns new connection.

Args:
  connection - Connection record
  k - Metadata key to remove

Returns:
  New Connection record with updated metadata
sourceraw docstring

explain-connectionclj

(explain-connection connection)

Explain why connection is invalid.

Pure function - returns validation errors.

Args: connection - Connection record

Returns: Malli explanation or nil if valid

Explain why connection is invalid.

Pure function - returns validation errors.

Args:
  connection - Connection record

Returns:
  Malli explanation or nil if valid
sourceraw docstring

filter-by-metadataclj

(filter-by-metadata connections pred)

Filter connections by metadata predicate.

Pure function - no side effects.

Args: connections - Collection of Connection records pred - Predicate function (metadata -> boolean)

Returns: Vector of connections matching predicate

Filter connections by metadata predicate.

Pure function - no side effects.

Args:
  connections - Collection of Connection records
  pred - Predicate function (metadata -> boolean)

Returns:
  Vector of connections matching predicate
sourceraw docstring

filter-by-roleclj

(filter-by-role connections role)

Filter connections by role.

Pure function - no side effects.

Args: connections - Collection of Connection records role - Role keyword to filter by

Returns: Vector of connections with specified role

Filter connections by role.

Pure function - no side effects.

Args:
  connections - Collection of Connection records
  role - Role keyword to filter by

Returns:
  Vector of connections with specified role
sourceraw docstring

filter-by-userclj

(filter-by-user connections user-id)

Filter connections by user ID.

Pure function - no side effects.

Args: connections - Collection of Connection records user-id - UUID to filter by

Returns: Vector of matching connections

Filter connections by user ID.

Pure function - no side effects.

Args:
  connections - Collection of Connection records
  user-id - UUID to filter by

Returns:
  Vector of matching connections
sourceraw docstring

update-metadataclj

(update-metadata connection f)

Update connection metadata.

Pure function - returns new connection, does not modify original.

Args: connection - Connection record f - Function to apply to metadata (metadata -> new-metadata)

Returns: New Connection record with updated metadata

Update connection metadata.

Pure function - returns new connection, does not modify original.

Args:
  connection - Connection record
  f - Function to apply to metadata (metadata -> new-metadata)

Returns:
  New Connection record with updated metadata
sourceraw docstring

valid-connection?clj

(valid-connection? connection)

Validate connection against schema.

Pure function - no side effects.

Args: connection - Connection record

Returns: Boolean - true if valid

Validate connection against schema.

Pure function - no side effects.

Args:
  connection - Connection record

Returns:
  Boolean - true if valid
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close