-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Handling messages limit based on messages size #32
Feat: Handling messages limit based on messages size #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor suggestions about naming to make it more aligned with specs in the DIDComm world.
Also we would need to update the client to allow sending this new limitBytes
parameter in takeFromQueue
. A simple way I'm thinking of is about adding a maxReceiveBytes?: number
in MessagePickupRepositoryClient
constructor:
constructor(options: { private readonly url: string, private readonly maxReceiveBytes?: number}) {}
And pass this.maxReceiveBytes
when calling the RPC method. Of course, this is not ideal but it is a solution to support it without requiring any modification into credo-ts and its MessagePickupRepository interface.
packages/server/src/websocket/dto/messagerepository-websocket.dto.ts
Outdated
Show resolved
Hide resolved
…dto.ts Co-authored-by: Ariel Gentile <[email protected]>
Co-authored-by: Ariel Gentile <[email protected]>
Co-authored-by: Ariel Gentile <[email protected]>
Co-authored-by: Ariel Gentile <[email protected]>
- Modified the constructor of `MessagePickupRepositoryClient` to accept a single `options` object. - Refactored `url` and `maxReceiveBytes` to be properties within the `options` object for more flexible parameter handling. - Ensured `url` and `maxReceiveBytes` remain `readonly` properties in the class.
The addMessage method implements the calculation of message size only (payload) in bytes for storage. Additionally, a constraint is implemented in the takeFromQueue function to return the number of messages that occupy up to 1 MB by default, which can also be configurable.