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 :: js get first element of array 
Javascript :: javascript array size 
Javascript :: electron hide devtools 
Javascript :: supertest multipart/form-data 
Javascript :: javascript storage get set item 
Javascript :: Group array of strings by first letter 
Javascript :: moment js get date 1 month 
Javascript :: return last two values of array in javascript 
Javascript :: or inside if javascript 
Javascript :: js script 
Javascript :: javascript toisostring without milliseconds 
Javascript :: Map in Javascript in LWC 
Javascript :: javascript trigger event 
Javascript :: object json parse nestjs 
Javascript :: forming an object with reduce 
Javascript :: flutter json to class 
Javascript :: react js date ago 
Javascript :: convert string to unicode javascript 
Javascript :: webpack env argument 
Javascript :: ok that is something 
Javascript :: js parse json 
Javascript :: Error R10 (Boot timeout) - Web process failed to bind to $PORT within 60 seconds of launch 
Javascript :: get the last day of the month in js 
Javascript :: array.unshift in javascript 
Javascript :: array filter 
Javascript :: javascript generate random number 
Javascript :: move canvas element to mouse 
Javascript :: upload preview image js 
Javascript :: javascript key event 
Javascript :: jquery find index of this 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =