- State :
State
Class representing the actual state of a stream
- Mode
Class representing the different modes of a stream
- Stream :
Stream
Class representing the actual state of a stream
- Message
Class representing the a MAM message
- Provider :
Provider
Class representing the interface of a Provider
State : State
Class representing the actual state of a stream
Kind: global class
- State :
State
- new State(seed, root, security, mode, sideKey)
- .MamState :
object
- .MamState
- .Subscribed :
array
- .Channel :
object
- .Seed :
string
- .Seed
- .Root :
string
- .Root
- .NextRoot :
string
- .NextRoot
- .Security :
int
- .Security
- .Mode :
string
- .Mode
- .SideKey :
string
|null
- .SideKey
- .Start :
int
- .Start
- .Index :
int
- .Index
- .Count :
int
- .Count
- .NextCount :
int
- .NextCount
- .Timeout :
int
- .Timeout
the created state
Param | Type | Default | Description |
---|---|---|---|
seed | string | null |
null |
The seed of the state |
root | string | null |
null |
The index root of the stream |
security | int |
2 |
the security level of the stream |
mode | string |
the mode of the stream | |
sideKey | string | null |
null |
optionally the sideKey for encrypting and decrypting messages |
– the state formatted as mam.client.js compatible object
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
mamState | object |
the state object returned by the mam.client.js library |
- subscribed channels (not used in this implementation)
Kind: instance property of State
Channel - the channel object of this state
Kind: instance property of State
the seed used in this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | string |
set the seed that should be used with this state |
the index root of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | string |
set the index root of this state |
the next root used for attatching new messages
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | string |
set the next root used for attatching new messages |
the security level of this tate
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | int |
set the security level of this state |
the mode of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | string |
set the mode of this state |
the optional sideKey for encrypting or decrypting messages
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | string | null |
set the optional sideKey for encrypting or decrypting messages |
the start of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | int |
set the start of this state |
the index of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | int |
set the index of this state |
the count of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | int |
set the count of this state |
the nextCount of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | int |
set the nextCount of this state |
the timeout of this state
Kind: instance property of State
Kind: instance property of State
Param | Type | Description |
---|---|---|
value | int |
set the timeout of this state |
Class representing the different modes of a stream
Kind: global class
Represents the public mode of a Stream
Kind: static property of Mode
Represents the private mode of a Stream
Kind: static property of Mode
Represents the restricted mode of a Stream
Kind: static property of Mode
Stream : Stream
Class representing the actual state of a stream
Kind: global class
- Stream :
Stream
- new Stream(messageProvider, seed, mode, security, sideKey)
- instance
- static
Creates a new stream object
Param | Type | Default | Description |
---|---|---|---|
messageProvider | Provider |
the url to a fullnode the messages should get attatched to | |
seed | string |
null |
the seed of the stream |
mode | string |
the mode of the stream | |
security | int |
2 |
the security level of the stream |
sideKey | string | null |
null |
the optional sideKey for encrypting and decrypting messages |
returns if this stream can also publish messages
Kind: instance property of Stream
stream.Provider : Provider
returns the actual provider of this stream
Kind: instance property of Stream
stream.State : State
returns the current state of this stream
Kind: instance property of Stream
Kind: instance property of Stream
Param | Type | Description |
---|---|---|
state | State |
sets the state of this stream |
Initializing the latest MAM-State of the stream
Kind: instance method of Stream
stream.fetchMessages(filters) : Array.<Message>
Fetch messages from the tangle or a storage provider
Kind: instance method of Stream
Param | Type | Description |
---|---|---|
filters | Object |
the filters that should be applied for fetching MAM messages |
filters.fromRoot | string | null |
the root since which the messages should be fetched from |
filters.start | int | null |
start value for pagination, skip start messages |
filters.limit | int | null |
the maximum number of messages that should get fetched |
filters.type | string | null |
the type of the messages that should get fetched |
filters.orderByDate | string | null |
the ordering of the messages asc (ascending) or desc (descending) |
stream.sendMessages(...messages) : Array.<Message>
Send message objects to the tangle
Kind: instance method of Stream
Param | Type | Description |
---|---|---|
...messages | Message |
the message objects that should get published |
Delete the stream and notify all listeners
Kind: instance method of Stream
Subscribe to a stream to get notified when new messages arrives
Kind: instance method of Stream
Param | Type | Default | Description |
---|---|---|---|
callback | function |
the method which should be called, when a new message arrives. Takes the message as argument | |
fromRoot | string | null |
null |
the root since which messages should get subscribed |
timeout | int | null |
|
the timeout of the interval the messages should get fetched |
Stream.createListenerStream(messageProvider, root, mode, security, sideKey) : Stream
Creates a new ListenerStream for reading new MAM messages
Kind: static method of Stream
Param | Type | Default | Description |
---|---|---|---|
messageProvider | Provider |
the url to a fullnode the messages should get attatched to | |
root | string |
the index root of the stream | |
mode | string |
the mode of the stream | |
security | int |
2 |
the security level of the stream |
sideKey | string | null |
null |
the optional sideKey for encrypting and decrypting messages |
Stream.createPublisherStream(messageProvider, seed, mode, security, sideKey) : Stream
Creates a new PublisherStream for sending and reading new MAM messages
Kind: static method of Stream
Param | Type | Default | Description |
---|---|---|---|
messageProvider | Provider |
the url to a fullnode the messages should get attatched to | |
seed | string |
the seed of the stream | |
mode | string |
the mode of the stream | |
security | int |
2 |
the security level of the stream |
sideKey | string | null |
null |
the optional sideKey for encrypting and decrypting messages |
Stream.initializePublisherStream(messageProvider, seed, mode, security, sideKey) : Stream
Initializes a already existing Stream for sending and reading new MAM messages
Kind: static method of Stream
Param | Type | Default | Description |
---|---|---|---|
messageProvider | Provider |
the url to a fullnode the messages should get attatched to | |
seed | string |
the seed of the stream | |
mode | string |
the mode of the stream | |
security | int |
2 |
the security level of the stream |
sideKey | string | null |
null |
the optional sideKey for encrypting and decrypting messages |
Class representing the a MAM message
Kind: global class
- Message
- instance
- .Trytes :
string
- .Raw :
Object
- .Message :
string
|int
|Object
|Array
- .Transactions :
Array
- .Type :
string
- .Publisher :
string
- .Timestamp :
Date
- .Trytes :
- static
- .TYPE_DELETION :
string
- .TYPE_PROMOTIONAL :
string
- .TYPE_TRANSACTIONAL :
string
- .createMessage(messageStream, message, type, publisher) :
Message
- .TYPE_DELETION :
- instance
the message as trytes string
Kind: instance property of Message
the raw message object
Kind: instance property of Message
the actual content of the message
Kind: instance property of Message
all transactions if this message is already attatched to the tangle
Kind: instance property of Message
the type of this message
Kind: instance property of Message
the publisher of this message
Kind: instance property of Message
the timestamp of this message
Kind: instance property of Message
the message type for Deletion
Kind: static property of Message
the message type for Promotional
Kind: static property of Message
the message type for Transactional
Kind: static property of Message
Message.createMessage(messageStream, message, type, publisher) : Message
Create a new MAM message
Kind: static method of Message
Param | Type | Default | Description |
---|---|---|---|
messageStream | Stream |
the stream this message should get published in or fetched from | |
message | string | int | Object | Array |
the actual content that should get published | |
type | string |
the type of this message | |
publisher | string | null |
null |
the publisher of this message |
Provider : Provider
Class representing the interface of a Provider
Kind: global class
Create a new Provider object
Param | Type | Default | Description |
---|---|---|---|
provider | string |
the url of the fullnode that should handle communication with the tangle | |
publisher | string |
null |
the name of the publisher attatched to all messages, where the publisher does not get overwritten |
attatchToTangle | function |
|
a function outsourcing or overwriting the attatchToTangle method |
Creating a stream or storing the stream details (but never publish the sideKey or seed!)
Kind: instance method of Provider
Param | Type |
---|---|
messageStream | Stream |
Update the state of the stream to it's latest state
Kind: instance method of Provider
Param | Type | Description |
---|---|---|
messageStream | Stream |
the stream the message should get published to |
provider.publishMessages(messageStream, ...messages) : Array.<Message>
Publish one or multiple messages to the tangle
Kind: instance method of Provider
Param | Type | Description |
---|---|---|
messageStream | Stream |
the stream the message should get published to |
...messages | Message |
the published messages |
provider.fetchMessages(messageStream, filters) : Array.<Message>
Fetch messages from the tangle or a permanent storage
Kind: instance method of Provider
Param | Type | Description |
---|---|---|
messageStream | Stream |
|
filters | Object |
the filters that should be applied for fetching MAM messages |
filters.fromRoot | string | null |
the root since which the messages should be fetched from |
filters.start | int | null |
start value for pagination, skip start messages |
filters.limit | int | null |
the maximum number of messages that should get fetched |
filters.type | string | null |
the type of the messages that should get fetched |
filters.orderByDate | string | null |
the ordering of the messages asc (ascending) or desc (descending) |