Comments (10)
hi i added the pub-sub support. but there is one thing you have to open 2 redis connection 1 will listen for subscribe (redis messages) and other is used to do command to redis.
from redis.
but in the main.swift you need to make changes as per your requirements.
from redis.
@surendratiwari3 Can you please provide an example on how to use your implementation?
from redis.
do {
try client.command("SUBSCRIBE", params: ["hello"])
print("Sending 'PING' to Redis server at \(client1.address):\(client1.port)")
let response11 = try client1.command("PING", params: []).toString()
print("Response: \(response11)")
while true
{
let response2 = try client.read().toArray()
var count = 0
for element in response2
{
count = count+1
let content = (element as! RespBulkString).content
if count==3
{
//published key
print(content)
//sending the command to redis
print("Sending HMGET \(content) to Redis server at \(client1.address):\(client1.port)")
let balance_res = try client1.command("HMGET", params: ["\(content)", "balance"]).toArray()
//get the balance from the redis
for ebal in balance_res
{
let bal = (ebal as! RespBulkString).content
print("Response: \(bal)")
}
}
}
}
} catch {
print("Encountered error (error)")
fatalError("(error)")
}
from redis.
please declare the client and client1 like this:
let client = try Redbird()
let client_ip = try Redbird(config: RedbirdConfig(address: "127.0.0.1"))
let client1 = try Redbird()
let client_ip1 = try Redbird(config: RedbirdConfig(address: "127.0.0.1"))
from redis.
Thanks @surendratiwari3 , got it working. Great job !!
from redis.
will you please do the same comment in the my pull request so they will accept it. and also please endorse me on linkledin . https://www.linkedin.com/in/surendra-tiwari-ab569a15?trk=nav_responsive_tab_profile
please also give comment also on linkedin
from redis.
I'm looking to dynamically change the list of topics that my pubsub connection subscribes to. It appears that the current Redbird code only lets me subscribe to one topic and then blocks.
Is there any way to allow me to send additional commands (subscribe/unsubscribe) while I am listening for messages using Redbird?
from redis.
yeah i provided a way to achieve that just take my pull request and enjoy!
from redis.
Added in #56
from redis.
Related Issues (20)
- add in PSUBSCRIBE HOT 2
- add more complex methods for ordered sets and others HOT 2
- Allow keyed cache access without `data` wrapper via `KeyedCacheSupporting` HOT 2
- Why does RedisClient use 'currentSend' to form an adhoc mutex? HOT 12
- Promises for commands in flight do not return when the connection is dropped HOT 4
- Redis 4 Docs HOT 1
- redis.command not working properly - works only with INFO HOT 1
- Redis should provide a Application.Sessions.Provider HOT 1
- ERR max number of clients reached on Heroku free tier HOT 2
- Precondition failed in Redis 4.1.0 when using repository pattern HOT 14
- Random Server Crashes, 4.1.0 HOT 3
- Cannot connect to remote Redis. HOT 1
- PubSub not work with redis 4.1.0 HOT 3
- Change RediStack dependency to GitHub's HOT 3
- Add Key Expiration to Encodable Set HOT 1
- Sending the Redis transaction commands HOT 1
- Redis Lists commands HOT 1
- Connection pooling interfering with PubSub HOT 6
- Compiler warning: deprecated version of flatMapThrowing HOT 1
- SSL Connections (rediss) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis.