# router
# publish M
# publish<T>(channel: string, payload: T): void
Publish a message on a channel.
import { router } from "@reactivemarkets/desktop-sdk";
router.publish("my_channel", {
any: "data",
});
# subscribe M
# subscribe<T>(channel: string, listener: (payload: T) => void): void
Subscribe to a channel.
import { router } from "@reactivemarkets/desktop-sdk";
router.subscribe("my_channel", (payload) => {
console.log(payload);
});
# unsubscribe M
# unsubscribe<T>(channel: string, listener: (payload: T) => void): void
Unsubscribe from a channel.
import { router } from "@reactivemarkets/desktop-sdk";
const listener = (data: string) => {
console.log(payload);
};
router.subscribe("my_channel", listener);
router.unsubscribe("my_channel", listener);