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

222
Vistas
how to send data from react to node

I'm Nodejs beginner, i'm using here rtsp-relay library for live streaming, currently it is working in frontend when URL is inlcuded, when creating a proxy object at server ' url: rtsp://.....@..../Stream/Channel/10,', but i dont want to include it there, i want to include it in frontend (user could write it in TextField) should i use fetch and send, any advice/help on this ? English is not my mother language, so could be mistakes.

const express = require('express');
const app = express();

const { proxy, scriptUrl } = require('rtsp-relay')(app);

const handle = proxy({
  url: `rtsp://.....@..../Stream/Channel/10`,
  // the URL above is credentials
  verbose: false,
  transport: 'tcp',
});

app.ws('/api/stream', handle );

app.get('/', (req, res) =>
  res.send(
    `hg`,
 
  ),
);

app.listen(5000);

React (material-ui):

const updateUrl = () => {
    return (
      <React.Fragment>
        <Box>
          <form
            onSubmit={handleUpdate}>
            <div>
              <Box>
                <Button
                  onClick={nulll}
                  aria-label="close-settings-popup">
                  <Close />
                </Button>
              </Box>
            </div>
            <FormGroup>
              <Box>
                <FormControl>
                  <TextField
                    type="text"
                    id="URL"
                    value={source}
                    onChange={handleChange}
                    label={
                      <Trans i18nKey="form.cameraForm.source">URL</Trans>
                    }
                  ></TextField>
                </FormControl>
              </Box>
            </FormGroup>
            <div>
              <Button type="submit" variant="contained" color="primary">
                Accept
              </Button>
            </div>
          </form>
        </Box>
      </React.Fragment>
    );
  };

this is what rtsp creator wrote:

enter image description here

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

0

As far as I can understand with what you have asked, you need to create a websocket connection from the client-side.

const ws = new WebSocket('ws://localhost:3000/ws') //Your url should be here

This is a basic webscoket connection using JavaScript native WebSocket API, you can use either other libraries like socket.io.

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