Files
services/examples/stream/publish/node/publishAMessage.js
2021-09-16 12:52:36 +01:00

18 lines
439 B
JavaScript
Executable File

import * as stream from "m3o/stream";
// Publish a message to the stream. Specify a topic to group messages for a specific topic.
async function PublishAmessage() {
let streamService = new stream.StreamService(process.env.MICRO_API_TOKEN);
let rsp = await streamService.publish({
message: {
id: "1",
type: "signup",
user: "john",
},
topic: "events",
});
console.log(rsp);
}
await PublishAmessage();