Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
Is it possible to send a ping opcode using javascript Websocket?

I have a websocket client and I want it to send a ping frame to my WS server. According to the RFC 6455 a ping frame is represented by opcode %x9 but I don't know if it's even possible to send from a browser.

Any help will be appreciated

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Building on-top of the comments in your original post, you can manually send pings via websocket.

The link by Daniel W. of the ws library has a ping() method which can be called from a valid websocket client. See an example here.

If you have written your own websocket library then you must conform to the standard framing outlined in RFC6455 The Websocket Protocol.

You should be able to pack a buffer with the correct header and control opcode and send it over the upgraded HTTP1.1 TCP connection.

Edit:
Further research shows, at the point of writing, the Ping method is not supported via the native Websocket Client and the send method seems to only support payloads and not command messages, which include opcodes for commands such as ping.

An option could be to go with a WASM based solution which could make non-XHR or non-fetch based TCP connections, however this comes with a whole different set of challenges.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda