2

This is what i want

enter image description here

But this is what i get:

enter image description here

Here is my code:

    function App() {
  const greeting = 'Hello Function Component!';


  const socket = new WebSocket('ws://192.168.99.9/video');

  socket.binaryType = 'arraybuffer';

  socket.onopen = (event) => console.log('Video connected');
 

  socket.onmessage = (event) => {
         // Show the Binary messages 
         console.log('Testing:')
         console.log(event.data)
  }

  return <h1> {greeting} </h1>;
}

export default App;

enter image description here

The WebSocket connection is created successfullly, but i still not get the binary messages. I thought when the connection established, i would get the messages.

where i did wrong

Tùng Sơn
  • 65
  • 1
  • 1
  • 3

0 Answers0