I tried to emit a username variable to the server using: socket.emit('set username', 'text-username');.This emits successfully (I think) because the alert message following shows up successfully.On the server.js, the following code is under the io.on('connection',...socket.on('setUsername', function (username) { console.log(username + ' joined'); });Yet, I don't get test-username joined in the console when I submit the form.Other things work well on click on the form. What's wrong?
Submitted November 25, 2017 at 02:48AM by Akidus
No comments:
Post a Comment