Using redis to Create Channels in nodejs

  node.js, question




Prompts that the publish method does not exist.

Find the reason:

Line 56 of the code:

//socket.on('connect', function() {
 subscriber = redis.createClient(32768, '');  //Create a subscription client for users
 subscriber.subscribe('main_chat_room');  //reserve channel
 On ('message', function (channel, message) {//channel sends the message to the user after receiving it.
 Socket.write('Channel' plus channel plus':' plus message);
 publisher = redis.createClient(32768, '');  //Create a publishing client for users