Messaging
A Void Merge service provides the ability to send messages to connected clients and can be set up so clients can message each other.
Create a new messaging channel for a client.
const { msgId } = await VM.msgNew();
// In the client code:
import * as VM from "@voidmerge/voidmerge-client"
const listener = await VM.MsgListener.connect({
msgId,
...
});
List open messaging channels.
const { msgIdList } = await VM.msgList();
Send a message over an open channel.
await VM.msgSend({
msg: new TextEncoder().encode("hello"),
msgId,
});