ws-asyncapi API / core / LocalBackplane
Class: LocalBackplane
Defined in: .api-entries/core/index.d.ts:382
Implements
Constructors
Constructor
new LocalBackplane(
options?):LocalBackplane
Defined in: .api-entries/core/index.d.ts:385
Parameters
options?
Returns
LocalBackplane
Properties
nodeId
readonlynodeId:`${string}-${string}-${string}-${string}-${string}`
Defined in: .api-entries/core/index.d.ts:384
unique id of this server node
Implementation of
Methods
onMessage()
onMessage(
handler):void
Defined in: .api-entries/core/index.d.ts:386
Register the local delivery callback (called once by the adapter).
Parameters
handler
(message) => void
Returns
void
Implementation of
publish()
publish(
topic,payload,offset?,except?):Promise<void>
Defined in: .api-entries/core/index.d.ts:387
Fan a message out to all nodes; each delivers locally to subscribers. When offset is supplied (recovery-capable backplanes) the message is also appended to the replay log under that offset.
Parameters
topic
string
payload
string | Uint8Array<ArrayBufferLike>
offset?
string | number
except?
string[]
Returns
Promise<void>
Implementation of
assignOffset()
assignOffset():
number
Defined in: .api-entries/core/index.d.ts:388
Vend the next monotonic, cluster-wide offset for an outgoing event.
Returns
number
Implementation of
replaySince()
replaySince(
offset,topics):Promise<BackplaneMessage[]>
Defined in: .api-entries/core/index.d.ts:389
Replay buffered events for the given topics whose offset is strictly greater than offset, in global publish order.
Parameters
offset
string | number
topics
string[]
Returns
Promise<BackplaneMessage[]>
Implementation of
saveSession()
saveSession(
sessionId,state):Promise<void>
Defined in: .api-entries/core/index.d.ts:390
Persist a disconnecting connection's recoverable state for ttlMs.
Parameters
sessionId
string
state
Returns
Promise<void>
Implementation of
loadSession()
loadSession(
sessionId):Promise<SessionState>
Defined in: .api-entries/core/index.d.ts:391
Load a reconnecting connection's state, or null if expired/unknown.
Parameters
sessionId
string
Returns
Promise<SessionState>
Implementation of
dropSession()
dropSession(
sessionId):Promise<void>
Defined in: .api-entries/core/index.d.ts:392
Drop a session once it has been recovered (or on hard close).
Parameters
sessionId
string
Returns
Promise<void>
Implementation of
addToRoom()
addToRoom(
topic,socketId):Promise<void>
Defined in: .api-entries/core/index.d.ts:393
Record that a local socket joined a room (topic).
Parameters
topic
string
socketId
string
Returns
Promise<void>
Implementation of
removeFromRoom()
removeFromRoom(
topic,socketId):Promise<void>
Defined in: .api-entries/core/index.d.ts:394
Record that a local socket left a room (topic).
Parameters
topic
string
socketId
string
Returns
Promise<void>
Implementation of
removeSocket()
removeSocket(
socketId):Promise<void>
Defined in: .api-entries/core/index.d.ts:395
Remove a socket from all rooms (on disconnect).
Parameters
socketId
string
Returns
Promise<void>
Implementation of
setPresence()
setPresence(
room,socketId,state):Promise<void>
Defined in: .api-entries/core/index.d.ts:396
Store (or replace) a member's presence state in a room.
Parameters
room
string
socketId
string
state
unknown
Returns
Promise<void>
Implementation of
clearPresence()
clearPresence(
room,socketId):Promise<void>
Defined in: .api-entries/core/index.d.ts:397
Remove a member from a room's presence roster.
Parameters
room
string
socketId
string
Returns
Promise<void>
Implementation of
getPresence()
getPresence(
room):Promise<Record<string,unknown>>
Defined in: .api-entries/core/index.d.ts:398
Current roster of a presence room: socket id → state.
Parameters
room
string
Returns
Promise<Record<string, unknown>>
Implementation of
configureHistory()
configureHistory(
events):void
Defined in: .api-entries/core/index.d.ts:399
Register which event names to retain and how many (event name → keep).
Parameters
events
Record<string, number>
Returns
void
Implementation of
appendHistory()
appendHistory(
topic,event,data):Promise<void>
Defined in: .api-entries/core/index.d.ts:400
Append an event to a room's history (no-op if the event isn't retained).
Parameters
topic
string
event
string
data
unknown
Returns
Promise<void>
Implementation of
getHistory()
getHistory(
topic,limit?):Promise<object[]>
Defined in: .api-entries/core/index.d.ts:401
Fetch a room's retained events (most-recent limit, or all), in order.
Parameters
topic
string
limit?
number
Returns
Promise<object[]>
Implementation of
roomMembers()
roomMembers(
topic):Promise<string[]>
Defined in: .api-entries/core/index.d.ts:405
Cluster-wide socket ids in a room (presence / fetchSockets).
Parameters
topic
string
Returns
Promise<string[]>
Implementation of
rooms()
rooms(
socketId):Promise<string[]>
Defined in: .api-entries/core/index.d.ts:406
Rooms a socket currently belongs to.
Parameters
socketId
string
Returns
Promise<string[]>
Implementation of
close()
close():
Promise<void>
Defined in: .api-entries/core/index.d.ts:407
Returns
Promise<void>