Is it possible to get all the channels associated with a Pubnub subscribe key?
All channels that were ever created using this key?
Thanks,
You can get a list of all channels that are actively subscribed to using a Global Here Now call - http://www.pubnub.com/docs/web-javascript/presence#gobal_here_now
There is no option to get a list of channels that were "created" in the past but are not active now. Here are a couple of alternatives that could work for you.
Stream Controller (Channel Groups)
With channel groups, you can manage subscriptions to channels centrally. By assigning a channel group to each user, you can list all channels (active or inactive) that were added to their channel group. PubNub maintains the subscription list for all channel groups and here's how you will retrieve them
http://www.pubnub.com/docs/web-javascript/stream-controller#listing_channels_within_group
Presence Callbacks
PubNub allows you to specify a HTTP callback URL that is triggered when a channel becomes "active" or "inactive". This way, your server will be notified whenever a channel is "created" and you can persist that information to a database so you can query at a later time.
Related
I want to share messages from many channels in Telegram to one channel with my account inside the channel.
You can add modir_robot as admin of your output channel, then start the bot and follow setting page to add you input channels.
I need to know the user presence when he will join only his inbound channel. as I need to take some action in my project when the action of user is join and channel is inbound.
is there any way from which my REST endpoint called when only same events occur?
PubNub Presence Web Hooks apply to all channels and cannot be configured to apply to just some channels. So you will receive join events on all channels.
Is it possible in pubnub that one can publish to a channel group and receive the message to all channels that were added to channel group?
Publishing to a Channel Group
Publishing to a channel group or mulitiple channels is not a supported at this time. Using PubNub BLOCKS, you will be able to implement a pattern that would do this in a scalable fashion.
The question is...
Why not have all the clients subscribe to the same channel and publish the message once to that channel?
I'm sure you have a valid requirement here but would like to understand the details of it first.
I wanted to remove all the channels with in a channel group in a single api call. it is possible ? or do we have to iterate through the list of channels ?
PubNub Channel Groups - Removing all Channels
You can do this using the remove group API (name varies per SDK). For JavaScript, the function is named channel_group_remove_group
pubnub.channel_group_remove_group({
callback: displayCallback,
error: displayCallback,
channel_group: channelGroup
});
This must be called from the app that is subscribed to the channel group. In other words, it can't be called on behalf of the client by the server.
If you want to have your server add and remove channels to and from channel groups (on behalf of the clients), then the server's PubNub instance needs to be granted the manage permission (if you are using Access Manager, otherwise, anyone can do this) and just add and remove channels from those channel groups.
You can provide a list of channels to be added or removed but you do have to iterate through the channel groups that the channels need to be added to or removed from.
Is there a way to make the client have only read-only permissions to channels since we are distributing the client key with the web app using the pusher.js sdk?
The application key itself does not determine the permissions of a client. It only identifies which application the client is connecting to.
By default all subscriptions are read-only. Pusher offers three channel types:
Public
Private - with a private- name prefix that also requires subscription authentication
Presence - with a presence- prefix that also require subscription authentication and additional functionality for adding functionality to show which users are subscribed to that channel
A above, in order to subscribe to either Private or Presence channels your server needs to authentication the subscription request.
If you actually want a client to be able to trigger events on channels you need to:
Enable client events for an application
Subscribe to, and be authenticated for, a private or presence channel: channel = pusher.subscribe('private-channel')
Once subscribed (check using the pusher:subscription_succeeded callback) call channel.trigger('client-event', eventData) being sure to prefix the event name with client-