Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to implement redis pub sub model using nodejs

var redis = require(“redis”);var publisher = redis.createClient();publisher.publish(“notification”, “{”message”:”Hello world from Asgardian!”}”, function(){ process.exit(0);});
Comment

redis pub or sub nodejs

more example redis pub/sub -> https://github.com/restuwahyu13/express-todo-redis
Comment

how to implement redis pub sub model using nodejs

var redis = require(“redis”);var subscriber = redis.createClient();subscriber.on(“message”, function (channel, message) { console.log(“Message: “ + message + “ on channel: “ + channel + “ is arrive!”);});subscriber.subscribe(“notification”);
Comment

nodejs pub sub redis

1const express = require("express")
2const redis = require("redis")
3
4const publisher = redis.createClient()
5
6const app = express()
7
8app.get("/", (req, res) => {
9  const user = {
10    id: "123456",
11    name: "Davis",
12  }
13
14  publisher.publish("user-notify", JSON.stringify(user))
15  res.send("Publishing an Event using Redis")
16})
17
18app.listen(3005, () => {
19  console.log(`server is listening on PORT 3005`)
20})
Comment

PREVIOUS NEXT
Code Example
Javascript :: upload file angular rest api 
Javascript :: nodejs: router by use express and path package 
Javascript :: javascript function hoisting 
Javascript :: knex pagination plugin 
Javascript :: javascript compare dates 
Javascript :: node red json array 
Javascript :: multer gridfs storage 
Javascript :: vue js documentation 
Javascript :: jquery accordion toggle close open 
Javascript :: Declare and Initialize Arrays in javascript 
Javascript :: Fibonacci , fibo 
Javascript :: how to use $ in javascript 
Javascript :: web3.js tutorials 
Javascript :: web scraping using javascript 
Javascript :: oops in js 
Javascript :: typeorm in 
Javascript :: file upload in node js 
Javascript :: how to display json data in html 
Javascript :: angular file upload 
Javascript :: array reduce javascript 
Javascript :: alert in react native 
Javascript :: sample promise.all javascript 
Javascript :: parsley custom error message 
Javascript :: side effect, useEffect 
Javascript :: event handler 
Javascript :: react native stepper 
Javascript :: Get a random value from an array in JS 
Javascript :: JavaScript and HTML DOM Reference 
Javascript :: javascript filter array 
Javascript :: mongodb rename property 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =