You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SOS!!! The server-end can receive the event emitted by client-end, but the client-end can't receive the event from server-end. I show my code as below:
// client.vue (client-end)<template>
...
</template><script>exportdefault{sockets: {connect: function(){console.log('socket connected');// This cmd dosn't works},serverEmit: function(msg){console.log("Message:"+msg);// This cmd dosn't works}},methods: {trigger(){this.$socket.emit('clientEmit',"I'm a message from client.");// This cmd works well}}}</script>
// server.js(server-end)io.on('connection',(socket)=>{console.log('Socket connect successful.');// This cmd works wellsocket.on('clientEmit',(msg)=>{console.log("Message: "+msg);socket.emit('serverEmit',"I'm a message from server.");// This cmd works well});});
I think the option 'sockets' is not useful in vue2.0 anymore.
The text was updated successfully, but these errors were encountered:
SOS!!! The server-end can receive the event emitted by client-end, but the client-end can't receive the event from server-end. I show my code as below:
I think the option 'sockets' is not useful in vue2.0 anymore.
The text was updated successfully, but these errors were encountered: