PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
New WINDEV, WEBDEV 24 feature!
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Subscribes to a Redis broadcast channel. The application will then be notified about messages sent by applications connected to the Redis server that publishes messages on that channel.
Example
INTERNAL PROCEDURE OnRedis(nType is int, sChannel is string, bufMessage is Buffer)
SWITCH nType
CASE redisSubscribe
Trace("Subscription to " + sChannel)
CASE redisUnsubscribe
Trace("Cancel subscription to " + sChannel)
CASE redisDisconnection
Trace("Disconnection: " + sChannel)
CASE redisMessage
Trace("Message on " + sChannel+": " + UTF8ToString(bufMessage))
OTHER CASE
Trace("Unknown")
END
END

RedisSubscribe(gRedis, "MyChannel", OnRedis)
Syntax
<Result> = RedisSubscribe(<Connection> , <Channel> , <Procedure name>)
<Result>: Boolean
  • True is successfully subscribed,
  • False otherwise.
<Connection>: redisConnection variable
Name of the redisConnection variable that corresponds to the Redis server connection.
<Channel>: Character string (with quotes)
Name of the broadcast channel to which it is necessary to subscribe in order to receive messages.
<Procedure name>: Character string (with or without quotes)
Name of the WLanguage procedure ("callback") called:
  • when a message is received,
  • when subscribing,
  • when unsubscribing,
  • when disconnecting.
This procedure makes it possible to manage the current message. It will be called in a specific thread.
This procedure has the following format:
PROCEDURE <Procedure name>(<Type>, <Subscription channel>, <Message>)
  • <Type> contains the type of message. This parameter corresponds to one of the following constants:
    redisSubscription The application has just subscribed to <Subscription channel>.
    redisUnsubscribeThe application has just unsubscribed from <Subscription channel>
    redisDisconnectionThe connection to the Redis server has been lost.
    If the procedure returns False, the application loses its subscription. Otherwise, the application will try to reconnect to the Redis server.
    redisMessageThe application has just received a message. In this case, <Message> contains the body of the message.
  • <Subscription channelt> is a character string that contains the name of the channel to which the application subscribed.
  • <Message> is a buffer that corresponds to the content of the message.
Component : wd240big.dll
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment