Class: Messaging
Defined in: bee-js/src/modules/messaging.ts:40
Messaging protocols — PSS (Postal Service for Swarm) and GSOC. Method names keep
their pss/gsoc prefixes to distinguish the two protocols within the namespace.
Accessed as bee.messaging.
Constructors
Constructor
new Messaging(
context):Messaging
Defined in: bee-js/src/modules/messaging.ts:41
Parameters
context
BeeContext
Returns
Messaging
Methods
gsocMine()
gsocMine(
targetOverlay,identifier,proximity):PrivateKey
Defined in: bee-js/src/modules/messaging.ts:153
Mines the signer (a private key) to be used to send GSOC messages to the specific target overlay address.
Parameters
targetOverlay
string | Uint8Array<ArrayBufferLike> | PeerAddress
identifier
string | Uint8Array<ArrayBufferLike> | Identifier
proximity
number = 12
Returns
gsocSend()
gsocSend(
postageBatchId,signer,identifier,data,options?,requestOptions?):Promise<UploadResult>
Defined in: bee-js/src/modules/messaging.ts:188
Sends a GSOC message with the specified signer and identifier.
Warning! Only full nodes can accept GSOC messages.
Parameters
postageBatchId
string | Uint8Array<ArrayBufferLike> | BatchId
signer
string | Uint8Array<ArrayBufferLike> | PrivateKey
identifier
string | Uint8Array<ArrayBufferLike> | Identifier
data
string | Uint8Array<ArrayBufferLike>
options?
requestOptions?
Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
Returns
Promise<UploadResult>
gsocSubscribe()
gsocSubscribe(
address,identifier,handler):GsocSubscription
Defined in: bee-js/src/modules/messaging.ts:215
Subscribes to GSOC messages for the specified owner (of the signer) and identifier.
Warning! Only full nodes can accept GSOC messages.
Parameters
address
string | Uint8Array<ArrayBufferLike> | EthAddress
identifier
string | Uint8Array<ArrayBufferLike> | Identifier
handler
Returns
pssReceive()
pssReceive(
topic,timeoutMsec):Promise<Bytes>
Defined in: bee-js/src/modules/messaging.ts:113
Receives a single message using the Postal Service for Swarm.
Warning! Only full nodes can accept PSS messages.
Parameters
topic
Topic name
timeoutMsec
number = 0
Timeout in milliseconds
Returns
Promise<Bytes>
pssSend()
pssSend(
postageBatchId,topic,target,data,recipient?,requestOptions?):Promise<void>
Defined in: bee-js/src/modules/messaging.ts:55
Sends data to a recipient or target with the Postal Service for Swarm.
Warning! Only full nodes can accept PSS messages.
Parameters
postageBatchId
Postage BatchId that will be assigned to the sent message.
string | Uint8Array<ArrayBufferLike> | BatchId
topic
Topic name
target
string
Target message address prefix
data
Message to send
string | Uint8Array<ArrayBufferLike>
recipient?
Optional recipient public key
string | PublicKey
requestOptions?
Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
Returns
Promise<void>
pssSubscribe()
pssSubscribe(
topic,handler):PssSubscription
Defined in: bee-js/src/modules/messaging.ts:79
Subscribes to messages for the given topic with the Postal Service for Swarm.
Warning! Only full nodes can accept PSS messages.
Parameters
topic
Topic name
handler
Message handler interface