Skip to content
Advertisement

Socket.io – listen events in separate files in node.js

For example my idea is:

File1.js

JavaScript

File2.js

JavaScript

This code is for a node server, will I have problems with this code?

Advertisement

Answer

Nope, just use the same “io” object.

File1.js

JavaScript

File2.js

JavaScript

app.js

JavaScript

index.html

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement