Answer the question
In order to leave comments, you need to log in
How to make a variable from Socket.io available everywhere?
Hello.
There is such a Socket.io bullshit:
socket.on('Название события', data => {
const переменная = data
})
Answer the question
In order to leave comments, you need to log in
Declare a variable at a higher visibility level and reassign it when you need to.
Or do I need to declare it globally? I'm not a node expert, but there is some kind of global object there, it seems like window on the front, you can try to put it in it.
PS What is it for?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question