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

223
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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