Adds the listener function to the end of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple
times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The
emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
Adds the listener function to the end of the listeners array for the
event named eventName. No checks are made to see if the listener has
already been added. Multiple calls passing the same combination of eventName
and listener will result in the listener being added, and called, multiple
times.
server.on('connection', (stream) => {
console.log('someone connected!');
});
Returns a reference to the EventEmitter, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The
emitter.prependListener() method can be used as an alternative to add the
event listener to the beginning of the listeners array.
The console.error() static method outputs a message to the console at the "error" log level. The message is only displayed to the user if the console is configured to display error output. In most cases, the log level is configured within the console UI. The message may be formatted as an error, with red colors and call stack information.
Start conversation and message streams. Calling this while running is a no-op.
start();
The Agent awaits async message and conversation listeners. Return or await all work that must finish before message delivery is accepted. A task that runs without await can continue after acceptance.
Conversation events exclude conversations already stored locally. They include a pending Welcome when the client first discovers its conversation.
start means that local readers are ready. It does not confirm a backend connection. Retryable network errors use the core recovery budget. A terminal stream error stops both readers. Handling the error does not restart them. Call agent.start() to start a new reader generation. Use onConnectionStateChange in the start() options to observe connection state.
Agent message events differ from the SDK client events. Use agent.client to listen for local storage, consent, and message-status changes.