|
|
|
@ -23,9 +23,12 @@ exports.sendText = async ctx => {
|
|
|
|
|
}
|
|
|
|
|
// return wsToSend;
|
|
|
|
|
try {
|
|
|
|
|
const sockMsg = wsToSend.sendTextMessage(to, content);
|
|
|
|
|
const sockMsg = await wsToSend.sendTextMessage(to, content);
|
|
|
|
|
const {
|
|
|
|
|
key: { id },
|
|
|
|
|
} = sockMsg;
|
|
|
|
|
console.log(JSON.stringify(sockMsg, undefined, 2));
|
|
|
|
|
await upsertOutboundMessage(null, { ...ctx.request.body, id: sockMsg.key || sockMsg.id });
|
|
|
|
|
await upsertOutboundMessage(null, { ...ctx.request.body, id });
|
|
|
|
|
return 'Message sent successfully'; // { wsToSend, ret: 'Message sent successfully' };
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Error sending message:', error);
|
|
|
|
|