N
N
nezzard2016-12-26 13:39:08
Node.js
nezzard, 2016-12-26 13:39:08

How to constantly receive data from a socket?

Good afternoon, I understand that it is not clear from the name what I need, I will try to describe.
there are 3 sides Playlist.html -> app.js ->
Playlist.html client sends to app,js playlist, client should get data from app.js when connecting.
Looks like this
Playlist.html
socket.emit('songchanged', stringTableCur);
App.js

socket.on('songchanged', function(changed){
   console.log(changed);
});

And the client must do something similar
socket.emit('getSong');
. But it is clear that the design will not work
socket.on('songchanged', function(changed){
  socket.on('getSong, function(data){
      emit...
  })
});

Option to enter in a json file, maybe there is another option?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question