Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

feat: update publish function signature #62

Merged
merged 3 commits into from
Jul 15, 2020

Conversation

wemeetagain
Copy link
Member

@wemeetagain wemeetagain commented Jul 14, 2020

Resolves #51

BREAKING CHANGE: the publish function signature now takes a single
message as its second parameter, instead of optionally an array of
messages.

BREAKING CHANGE: the publish function signature now takes a single
message as its second parameter, instead of optionally an array of
messages.
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated
@@ -314,11 +314,11 @@ class PubsubBaseProtocol extends EventEmitter {
* For example, a Floodsub implementation might simply publish each message to each topic for every peer
* @abstract
* @param {Array<string>|string} topics
* @param {Array<any>|any} messages
* @returns {Promise}
* @param {Buffer | string} message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {Buffer | string} message
* @param {Buffer} message

Considering that we are breaking this, I would go with only Buffer, to be the same as https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#pubsubpublish
What do you think? Reducing the scope means less code to maintain and less edge cases that might appear

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I just set this bc that is what the protobuf encoder will accept.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds fair to me

@vasco-santos vasco-santos merged commit 085dfcf into libp2p:v0.6.x Jul 15, 2020
@wemeetagain wemeetagain deleted the feat/refactor-publish branch July 21, 2020 14:55
vasco-santos pushed a commit that referenced this pull request Aug 11, 2020
BREAKING CHANGE: the publish function signature now takes a single
message as its second parameter, instead of optionally an array of
messages.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants