Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
how to set time to xmpp stanzas object

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
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda