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

186
Vistas
running websocket in google sheet without using HTML code

I find this test for Binance websocket in app script the code in this URL:

running websocket in google sheet

I want to remove code HTML and run websocket without using HTML code.

I want just use:

  

function onOpen(e) {
  SpreadsheetApp.getUi()
    .createMenu('BINANCE')
    .addItem('RUN', 'runwebsocket')
    .addToUi();
  
}

to run websocket

any suggest for the problem .

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

One solution is to embed the html javascript in a blank page

index.html

<!DOCTYPE html>
<meta charset="utf-8" />

<head>
  <script language="javascript" type="text/javascript">
    var wsUri = ("wss://stream.binance.com:9443/ws");
  <? var myparam = param(); ?>
  
  function init()  {
    websocket = new WebSocket(wsUri);
    websocket.onopen = function(evt) { onOpen(evt) };
    websocket.onclose = function(evt) { onClose(evt) };
    websocket.onmessage = function(evt) { onMessage(evt) };
    websocket.onerror = function(evt) { onError(evt) };
    nbr=0;
  }

  function onOpen(evt)  {
    doSend(<?= myparam ?>);
  }

  function onClose(evt)  {
  }

  function onMessage(evt)  {
    google.script.run.getJSON( evt.data );
  }

  function onError(evt)  {
  }

  function doSend(message)  {
    websocket.send(message);
  }

  window.addEventListener("load", init, false);
  window.addEventListener("beforeunload", websocket.close, false);
  
  </script>
</head>

<body></body>

</html>

you can lunch this way

function modal() {
  var html = HtmlService
    .createTemplateFromFile("index")
    .evaluate()
    .setWidth(100)
    .setHeight(50);
  SpreadsheetApp.getUi().showModelessDialog(html, 'web socket');
}

enter image description here

about 4 years ago · Santiago Trujillo 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