Map User Id with Connection Id - wpf

I am creating a chat application using Wpf. So far I have created all the basic interfaces and most of the methods required. I am maintaining a database and it also saves details of all the users along with an auto incremental user id.
I am trying to use SignalR to send messages between online users connected to a hub. At the same time, a copy of the message is saved in the database with a sending user id and receiving user id.
When a message is sent to a user via a hub, I specify the user id of the receiver of the message. But when sending it to the receiver from the hub, I don't know how to map the user id with the connection id of the receiver.
How can I accomplish this task?

Check out this link
Mapping ASP.NET SignalR Connections to Real Application Users
basically this is done by overriding OnConnected and OnDisconnected of Hub class

Related

How can I make a distinction between shared and user mailboxes in PowerAutomate?

I want to check in a flow whether an internal mail address is a shared or user mailbox. Depending on this, I would branch off whether a mail is sent from a shared or user mailbox (PowerAutomate has two events for sending mails, one for shared and one for a normal user mailbox). Is this possible and how?
Similar to power automate , logic app has outlook office 365 connector supports both sending an email from shared or user mail boxes by using the below actions.

Send Email When Match in Firebase Database

I'm trying to build a web app using AngularJS and Firebase that sends an email to two users that match on certain parameters. The users submit their information first and if there is a match with another person in the database, I want to send an email to both those people. For example, if two people, A and B both have the age of 25, I would like to send A and B an email with certain information. Is this possible using Firebase?
If you are NOT running a server
Yes
You could achieve it by using a service like Zapier.
You could create a zap linking FireBase and an e-mail service like Mandrill.
A Zap combines triggers and actions — whenever the trigger event occurs, Zapier automatically completes the action for you!
When there is a match, update a special key in your FireBase database.
As Zapier is listening to updates of that particular key, it will react by sending your e-mails via Mandrill.
March 2017 UPDATE
New tools have now been added to Firebase to trigger database event handlers:
database events triggers: https://firebase.google.com/docs/functions/database-events
cloud functions for FireBase: https://firebase.google.com/docs/functions/functions-and-firebase
using cloud functions to send e-mails through sendGrid:
https://cloud.google.com/functions/docs/tutorials/sendgrid
If you are running a server
Your server can easily check the values in FireBase and send e-mails accordingly. That would then be a
Yes, of course :)

How can I write a query for notification request from application to Database?

This is my perivous question in stackoverflow about how to push the data from database instead of application pull data.
After went through the link and the documents I come to know that I need to write a query in application side for notification request then the DB will register my request in subscription and If there is any change in the DB it will check subscription, if the request is there it will send the message to the client.
This paragraph is from the above mentioned link:
Along with the query submitted for the notification, the client submits a service name
and a broker instance. Each notification subscription begins a Service Broker dialog
with this provided service and broker instance. When data is changed and the change
would affect the result of the submitted query result, a message is sent on this dialog. By sending this message, the client is considered notified and the notification
subscription is removed. If client desires to be notified on further changes, is supposed to subscribe again.
Now I don't know how to write a query in application side for notification request and I don't under stand submit a service and a broker instance from the above given para. I guess the service and broker instance needs to be created in application before query the database for notification request. If it is so how to create service and a broker instance?
I can check the DB server for subscription by select * from sys.dm_qn_subscriptions command. can anyone help me?
For Service Broker, you can find a ASP.NET MVC based step by step guide here. It also links to a github sample project for a better understand.
If you need just a callback to your SP/etc execution that's a BeginExecuteReader command -from application side-.
If you need DTS event handling only (or on top of other things) it is described here with sample codes.Hope this helps!

How to send and recive text in windows phone using silverlight?

I want to send a message from a windows phone to other windows phone via web services.
How can I do that?
Make use of Push Notifications. They are used to initiate an activity on a phone from a third party. There are three types of them: Tile Notification, Toast Notification and Raw Notification.
Toast Notifications (Example: SMS alert) are received when the application is not running. If for some reason sending from one phone to another implies that both of them run at the same time, consider using Raw Notifications. However, I suppose you should use both of them: if a Raw Notification is dropped (this usually means that the application is not running in the foreground), send Toast Notification.
As far as I undestand your requirements, you should do the following:
Once the application is started (or a user is logged in), establish Push channel and request PushUri for the phone from Microsoft Push Notification Server
Send the PushUri to your service, associate it with the user and save it.
To send a message to a phone application, just pass appropriate parameters to its PushUri. You can do this either from your web service or directly from another phone.
You may find the documentation useful. There are examples of how to establish, send and receive them.
P.S. Take into account that the second Toast Notification may fail as well because during the timespan between two Notifications the user may launch your application. Don't forget to handle this.

Getting Channel Client ID for RequestFactory requests

Is there any way to get the Channel ID on the server or transmit it inside a RequestFactory call?
Situation:
User starts the application, a channel is being opened.
User persists an entity with RequestFactory (requests.persist().using(...).fire(...)).
The persist() method on the server pings all connected clients to tell them that the entity has been updated.
But the user that made the initial change doesn't have to be pinged. Is there a way to find out which client made the change? It's not enough to know the user, because one user may have opened several windows (channels).
Honestly I haven't used Channel API yet but according to documentation each client is treated as separate user. So the solution lies beyond GAE API and I think you have two options:
Create logical User ID on the client that will be mapped to possibly multiple channels. That way you'll know what channels to skip.
Ping all channels anyway but send numeric Version of newly persisted entity. Then client will compare received version with what it has and if it's higher it means it needs to call findModel(id) again.

Resources