@@ -3,27 +3,27 @@ import OutputWindow from "../OutputWindow/OutputWindow";
3
3
import { io } from "socket.io-client" ;
4
4
5
5
export default function Output ( ) {
6
- const [ context , setContext ] = useState ( "" ) ; // Assuming context is a string
6
+ const [ context , setContext ] = useState ( "" ) ; // Assuming context is a string
7
7
8
- // Establish WebSocket connection
9
- const socket = io ( "http://127.0.0.1:5000" ) ;
8
+ // Establish WebSocket connection
9
+ const socket = io ( "http://127.0.0.1:5000" ) ;
10
10
11
- // client-side
12
- socket . on ( "connect" , ( ) => {
13
- console . log ( socket . id ) ;
14
- } ) ;
11
+ // client-side
12
+ socket . on ( "connect" , ( ) => {
13
+ console . log ( socket . id ) ;
14
+ } ) ;
15
15
16
- socket . on ( "disconnect" , ( ) => {
17
- console . log ( socket . id ) ; // undefined
18
- } ) ;
16
+ socket . on ( "disconnect" , ( ) => {
17
+ console . log ( socket . id ) ; // undefined
18
+ } ) ;
19
19
20
- socket . on ( "new-output" , ( data ) => {
21
- console . log ( "getting new output" ) ;
22
- console . log ( data ) ;
23
- // setContext((prev) => prev + data);
24
- } ) ;
20
+ socket . on ( "new-output" , ( data ) => {
21
+ console . log ( "getting new output" ) ;
22
+ console . log ( data ) ;
23
+ // setContext((prev) => prev + data);
24
+ } ) ;
25
25
26
- useEffect ( ( ) => { } , [ ] ) ; // Run this effect only once when the component mounts
26
+ useEffect ( ( ) => { } , [ ] ) ; // Run this effect only once when the component mounts
27
27
28
- return < OutputWindow context = { context } /> ;
28
+ return < OutputWindow context = { context } /> ;
29
29
}
0 commit comments