InMemoryTransport

class compas_eve.memory.InMemoryTransport[source]

Bases: Transport, EventEmitterMixin

In-Memory transport is ideal for simple single-process apps and testing.

It will only distribute messages within the same process, not across different processes.

Methods

advertise

Announce this code will publish messages to the specified topic.

on_ready

In-memory transport is always ready, it will immediately trigger the callback.

publish

Publish a message to a topic.

subscribe

Subscribe to a topic.

unadvertise

Announce that this code will stop publishing messages to the specified topic.

unsubscribe

Unsubscribe from the specified topic.

unsubscribe_by_id

Unsubscribe from the specified topic based on the subscription id.

Inherited Methods

emit

Emit event, passing *args and **kwargs to each attached function.

listeners

Returns a list of all listeners registered to the event.

off

Removes the function f from event.

on

Registers the function (or optionally an asyncio coroutine function) f to the event name event.

once

The same as ee.on, except that the listener is automatically removed after being called.

remove_all_listeners

Remove all listeners attached to event.

remove_listener

Removes the function f from event.