Skip to content

Commit

Permalink
docs: Updated interface and docs about queueLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 24, 2020
1 parent a486cfd commit 6b72608
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -126,6 +126,8 @@ Options:
* `persistence`: an instance of [AedesPersistence](http://npm.im/aedes-persistence), check [plugins](#plugins) for more persistence options. It's used to store *QoS > 1*, *retained*, *will* packets and subscriptions in memory or on disk (if not specified default persistence is in memory)
* `concurrency`: the max number of messages delivered concurrently,
defaults to `100`
* `queueLimit`: the max number of messages queued while client is waiting to connect,
defaults to `42`. If the number is exceeded `connectionError` is thrown with error `Client queue limit reached`
* `heartbeatInterval`: the interval at which the broker heartbeat is
emitted, it used by other broker in the cluster, defaults to
`60000` milliseconds
Expand Down
33 changes: 17 additions & 16 deletions types/index.d.ts
Expand Up @@ -10,7 +10,7 @@ import { Socket } from 'net'
import { IncomingMessage } from 'http'
import EventEmitter = NodeJS.EventEmitter

declare function aedes (options?: aedes.AedesOptions): aedes.Aedes
declare function aedes(options?: aedes.AedesOptions): aedes.Aedes

// eslint-disable-next-line no-redeclare
declare namespace aedes {
Expand All @@ -27,15 +27,15 @@ declare namespace aedes {
conn: Socket
req?: IncomingMessage

on (event: 'error', cb: (err: Error) => void): this
on(event: 'error', cb: (err: Error) => void): this

publish (message: IPublishPacket, callback?: () => void): void
subscribe (
publish(message: IPublishPacket, callback?: () => void): void
subscribe(
subscriptions: ISubscription | ISubscription[] | ISubscribePacket,
callback?: () => void
): void
unsubscribe (topicObjects: ISubscription | ISubscription[], callback?: () => void): void
close (callback?: () => void): void
unsubscribe(topicObjects: ISubscription | ISubscription[], callback?: () => void): void
close(callback?: () => void): void
}

export type PreConnectCallback = (client: Client, done: (err: Error | null, success: boolean) => void) => void
Expand Down Expand Up @@ -69,6 +69,7 @@ declare namespace aedes {
authorizeSubscribe?: AuthorizeSubscribeCallback
authorizeForward?: AuthorizeForwardCallback
published?: PublishedCallback
queueLimit?: number
}

export interface Aedes extends EventEmitter {
Expand All @@ -81,23 +82,23 @@ declare namespace aedes {
authorizeForward: AuthorizeForwardCallback
published: PublishedCallback

on (event: 'closed', cb: () => void): this
on (event: 'client' | 'clientReady' | 'clientDisconnect' | 'keepaliveTimeout' | 'connackSent', cb: (client: Client) => void): this
on (event: 'clientError' | 'connectionError', cb: (client: Client, error: Error) => void): this
on (event: 'ping' | 'publish' | 'ack', cb: (packet: any, client: Client) => void): this
on (event: 'subscribe' | 'unsubscribe', cb: (subscriptions: ISubscription | ISubscription[] | ISubscribePacket, client: Client) => void): this
on(event: 'closed', cb: () => void): this
on(event: 'client' | 'clientReady' | 'clientDisconnect' | 'keepaliveTimeout' | 'connackSent', cb: (client: Client) => void): this
on(event: 'clientError' | 'connectionError', cb: (client: Client, error: Error) => void): this
on(event: 'ping' | 'publish' | 'ack', cb: (packet: any, client: Client) => void): this
on(event: 'subscribe' | 'unsubscribe', cb: (subscriptions: ISubscription | ISubscription[] | ISubscribePacket, client: Client) => void): this

publish (packet: IPublishPacket & { topic: string | Buffer }, done: () => void): void
subscribe (topic: string, callback: (packet: ISubscribePacket, cb: () => void) => void, done: () => void): void
unsubscribe (
publish(packet: IPublishPacket & { topic: string | Buffer }, done: () => void): void
subscribe(topic: string, callback: (packet: ISubscribePacket, cb: () => void) => void, done: () => void): void
unsubscribe(
topic: string,
callback: (packet: IUnsubscribePacket, cb: () => void) => void,
done: () => void
): void
close (callback?: () => void): void
close(callback?: () => void): void
}

export function Server (options?: aedes.AedesOptions): aedes.Aedes
export function Server(options?: aedes.AedesOptions): aedes.Aedes
}

export = aedes

0 comments on commit 6b72608

Please sign in to comment.