I have an application that serves multiple customers. As part of my workflow, I would like to use PubNub for realtime messaging to customers, offering something like one channel per customer. I would like to just give my customers a subscription key that they can use to listen to messages on their particular channel.
Is this a supported scenario on Pubnub? What’s the right way to set this up? I assume that I will do all the setup on my side and also handle all the billing, while just handing my customers the subscription keys to their channels. But for now, on my Pubnub account, I only see one “subscribe key”. I would like all keys and customer data to be isolated from one another.
You should use the PAM access manager feature for handling this. In addition to the subscribe key you will also provide your customers an auth-token. You can grant access to an auth-token to publish/subscribe to a specific set of channels.
You can find more details here:
http://www.pubnub.com/docs/javascript/tutorial/access-manager.html
Related
I am trying to implement a chat functionality using azure communication services. One special use case is, that this chat must be administrated by one single administrative role.
This administrative role called "moderated" shall be allowed to delete selected messages from other chat participants.
Couldn't find a way to do this so far, any recommendations?
This is currently not supported.
Participants don't have write access to messages sent by other participants, which means only the message sender can update or delete their sent messages.
Please refer to the User Access section of the documentation for more details.
You can upvote the Implement basic Roles for the Chat Clients idea if you'd like to see this implemented in the future.
I'm working on a website that is supposed to offer users to make use of azures cognitive services api. They can play audio or use their microphone to transform speech into text.
I'm currently using azures js sdk and technically it's working fine. However, I noticed a big shortcoming with this approach. The sdk connects through a websocket with the azure server, which exposes the subscription key to the client. So every member could theoretically read it out and sell it or alike.
Furthermore, if the client connects directly with azure, I have no secure way of preventing clients abusing the service. I need a way to measure roughly how much time a customer uses the service to take into account individual billing.
I could not find anything about that in the official documentation. So what are my options?
Should I redirect the clients' audio input to my own server, do some quantitative analysis, and then forward the input from a server side connection to azure? I fear with many concurrent customers, it might get laggy or connections might get dropped...
Is there any way to attach at least client ids or alike to azure websocket connection that I can read out somehow later?
Do you have any advice for me?
Given your additional comment, I would suggest that you switch your implementation from using subscription key to using authentication tokens.
That would:
generate a unique token for each client, based on 1 global subscription key
not expose your subscription key to your clients
restrict the use of the API, as the token is only valid for 10 minutes
Each access token is valid for 10 minutes. You can get a new token at any time, however, to minimize network traffic and latency, we recommend using the same token for nine minutes.
See documentation here for global implementation. In a nutshell, you need to implement this token generation in your backend, and serve the page to your client with this token instead of the key.
Side note 1: be careful about the maximum number of concurrent requests (100 - see here).
Note 2: that will not help you bill clients given their usage as you have just 1 key and there is no way to identify distinct usages in it
Is there a way to send proactive cards from a bot to a Teams channel? The use case is a channel for service tickets. Once they get posted, a user will be able to interact with them with a few actions.
I’m looking at the documentation here for sending proactive messages. At the bottom, there’s a section for ”Creating channel conversations”, with a small reference to the startReplyChain(). However, the actual code and sample on GitHub still seem to reference a conversation with a member rather than sending something proactive to a channel.
There does appear to be documentation for incoming and outgoing webhooks, which is what I may end up doing. My only real concern is that it requires using Actionable Cards, which it references as legacy everywhere. This is despite saying that you can’t send Adaptive Cards with them. Perhaps they intend to enable these connectors to send Adaptive Cards, it’s not just very clear to me if this is a long-term solution I should be focusing on.
This is definitely possible, and it's important to note that you can even send from another process/application (e.g. on a schedule from an AWS Lamba). You can see a sample here for this.
The process of sending the message is just part of the story though - you need to have certain information already saved (e.g. in your database) to know how to contact the right user, group chat, or channel conversation, but there are a few ways to get that information. The most common is, when you bot is added to the conversation, to get it from the conversationUpdate event. You'll need conversation id, service url, tenant id, and your bot's App Id (what you get in the Azure portal for your bot, and which you're using already in your app's configuration, teams manifest, etc.). You can read more about the topic here and here.
Another option, if you don't have access to conversationUpdate (e.g. the user hasn't installed your app) is to call the Graph API to install your app. It's only possible to do this to a channel (on the v1 or beta api) (see here) or to a user (see here), but on the beta api only, and not (yet?) for a group chat.
I want to enable push notifications for a UWP mobile app connected to Azure app service with Azure SQL database. The notifications will alert only the users that are located within x kilometres from a certain geo coordinate.
However I'm not clear about how to track the users, My questions are as follows,
In my database should I store every user that uses the app and update their location periodically? I'm guessing I would need to do this in order to calculate which ones are in range and send notification to only those. However this leads me to my next question,
If I was going to store a record for each user in my database, what identifier is used for them? How are users identified on each device? Do they need to log in with an authorization provider like Facebook, Twitter, etc. in order for my app to record a unique identifier? Or is there a different mechanism to create or get a unique identifier?
#DaveSmits is on the right direction. You could register a GeofenceBackgroundtask to report user's location to your azure service. Besides current location, you also need to report current device channel Uri to your zaure device.
I believe you're familiar with WNS. If not, please check that document, it will explain what the channel Uri for you.
Then in your azure service, you need to save the location and channel Uri in some database tables. You would need to caculate the distance from a certain geo coordinate. If it meets the requirement, you can get all qualified channel Uris.(e.g. select channelUri from yourtable where location='xxxxx')
After you get all channel Uris, you could use it to send notifications to the specific users. About how to send notification, please check the WNS document.
I've answered a similar question on MSDN, it also needs to send notifications to the specific users.
there is nothing to track the location of the user in the push notifications. There are two things you can do:
solution 1:
- use a geofence that triggers a background task. If entering a geofence register for push notifications. If leaving the geofence unsubscribe again in your backend.
solution 2:
- Only send raw notifications and use a background task to handle them. In the background task evaulate the current location and if in the right location trigger the notification from code.
How would I communicate between two separate hubs?
So Hub1 is my ChatHub for Support Agents and Hub2 is my Hub for customers.
Support agents have logins, customers have a form they fill out which creates a user and so on. But how can I pass the user created from Hub2 to Hub1 for all the users who have a Hub1(Support Agents) or is there some better way to do this?
Would I need to handle it all in Hub1 with some logic for differentiating between customers and agents?
May not be possible since the Hubs aren't static they are created per user right?
The problem with doing it all in one Hub is after the form is filled out it sends them to another page so they get a new connectionId and they have no Context.User.Identity.Name so there is no way to grab them again since I don't know their information from the new page.
You can use GlobalHost.ConnectionManager for communicating between Hubs:
var ctx = GlobalHost.ConnectionManager.GetHubContext<HubName>();
ctx.Clients.All.methodName(parameter);