Learn R Programming

rredis (version 1.7.0)

redisPublish: redisPublish

Description

Publish data to a Redis message channel.

Usage

redisPublish(channel, message)

Arguments

channel
The channel name (character).
message
The message (any type, use RAW type for communication with non-R subscribers.

Value

Each subscribed channel corresponds to three list elements, the header 'subscribe' followed by the channel name and a count indicating the total number of subscriptions.

Details

(From the Redis.io documentation): redisSubscribe, redisUnsubscribe and redisPublish implement the Publish/Subscribe messaging paradigm where (citing Wikipedia) senders (publishers) are not programmed to send their messages to specific receivers (subscribers). Rather, published messages are characterized into channels, without knowledge of what (if any) subscribers there may be. Subscribers express interest in one or more channels, and only receive messages that are of interest, without knowledge of what (if any) publishers there are.

Use the Redis function redisUnsubscribe to unsubscribe from one or more channels. Service incoming messanges on the channels with either redisGetResponse or redisMonitorChannels.

Use of any other Redis after redisSubscribe prior to calling redisUnsubscribe will result in an error.

References

http://redis.io/commands

See Also

redisSubscribe redisUnsubscribe redisPublish redisGetResponse

redisMonitorChannels

Examples

Run this code
## Not run: 
# redisConnect()
# redisPublish('channel1', charToRaw('A raw charachter data message example'))
# ## End(Not run)

Run the code above in your browser using DataLab