Pixie.Backend behaviour

Used to implement the persistence backend for Pixie.

Source

Summary

client_subscribed?(client_id, channel_name)

Responds true or false depending on whether the client_id is subscribed to the given channel

create_client()

Create a client. Used internally by the protocol, you probably will never call this

dequeue_for(client_id)

Dequeue any messages awaiting delivery to the specified client. This is usually only called by the protocol when a client reconnects to retrieve any messages that arrived while the client was disconnected. Use publish instead

destroy_client(client_id)

Destroy the specified client registered to the provided client_id

destroy_client(client_id, reason)
generate_namespace()

Generate a unique identifier which can be used as a client_id, etc

generate_namespace(length)
get_client(client_id)

Retrieve the pid of the client registered to the provided client_id

ping_client(client_id)

Ping the specified client. This is specifically used for backends which will expire clients for inactivity (ie Redis)

publish(messages)

Publishes a collection of messages to all their receiving clients

queue_for(client_id, messages)

Queue messages for delivery to the specified client. This is usually only called by the protocol when publishing messages for clients which are either in-between polls or located on another Pixie instance. Use publish instead

release_namespace(namespace)

Release a namespace, which means it's theoretically possible to reuse it

start_link(name, options)

Called by the Pixie supervisor to start the selected backend

subscribe(client_id, channel_name)

Subscribe the specified client to the specified channel

subscribed_to(client_id)

Returns a HashSet containing the list of channels the client is subscribed to

subscribers_of(channel_name)

Returns a HashSet containing the list of client_ids subscribed to the provided channel

unsubscribe(client_id, channel_name)

Unsubscribe the specified client from the specified channel

Functions

client_subscribed?(client_id, channel_name)

Responds true or false depending on whether the client_id is subscribed to the given channel.

Source
create_client()

Create a client. Used internally by the protocol, you probably will never call this.

Source
dequeue_for(client_id)

Dequeue any messages awaiting delivery to the specified client. This is usually only called by the protocol when a client reconnects to retrieve any messages that arrived while the client was disconnected. Use publish instead.

Source
destroy_client(client_id)

Destroy the specified client registered to the provided client_id.

This function has the following side effects: - unsubscribes the client from all their subscribed channels. - destroys any channels with no subscribers left. - destroys any queued messages for the client. - releases the client_id namespace. - destroys the client process. - destroys the transport process (which has the side-effect of disconnecting the user).

Source
destroy_client(client_id, reason)
Source
generate_namespace()

Generate a unique identifier which can be used as a client_id, etc.

Source
generate_namespace(length)
Source
get_client(client_id)

Retrieve the pid of the client registered to the provided client_id.

Source
ping_client(client_id)

Ping the specified client. This is specifically used for backends which will expire clients for inactivity (ie Redis).

Source
publish(messages)

Publishes a collection of messages to all their receiving clients.

Source
queue_for(client_id, messages)

Queue messages for delivery to the specified client. This is usually only called by the protocol when publishing messages for clients which are either in-between polls or located on another Pixie instance. Use publish instead.

Source
release_namespace(namespace)

Release a namespace, which means it's theoretically possible to reuse it.

Source
start_link(name, options)

Called by the Pixie supervisor to start the selected backend.

Source
subscribe(client_id, channel_name)

Subscribe the specified client to the specified channel.

Source
subscribed_to(client_id)

Returns a HashSet containing the list of channels the client is subscribed to.

Source
subscribers_of(channel_name)

Returns a HashSet containing the list of client_ids subscribed to the provided channel.

Source
unsubscribe(client_id, channel_name)

Unsubscribe the specified client from the specified channel.

This function has the following side effects: - destroys any channels with no subscribers left.

Source