i have a xmpp server, then i have function to send message via xmpp and i use npm (@xmpp/client) for nodejs
var message = 'test';
const stanzas = xml("message", {
to: receiver,
type: "notification",
time: time.datetime()* //not work
}, xml("body", null, message),
xml("time", "urn:xmpp:time")) // not work
await xmpp.send(stanzas).catch(console.error);
*(2022-06-02T13:39:31Z)
This function works and send correct
The problem is that i cant set timeStamp for this
I just try to send time in main object of message, send in xml - no success
my result stanzas is:
Element {
name: 'message',
parent:
Element {
name: 'stream:stream',
parent: null,
children: [],
attrs:
{ version: '1.0',
xmlns: 'jabber:client',
'xmlns:stream': 'http://etherx.jabber.org/streams',
to: 'localhost',
'xml:lang': undefined } },
children:
[ Element { name: 'body', parent: [Circular], children: [Array], attrs: {} },
Element {
name: 'time',
parent: [Circular],
children: [],
attrs: [Object] } ],
attrs:
{ to: 'testJabber',
type: 'notification',
time: '2022-06-02T13:39:31Z' } }
What i get as a function success result:
()testServer : test
What i should get:
(02.06.2022 13:39:31)testServer : test