SignalR - Sending a Message to a subset of users - signalr

I need to send updates via SignalR to a users "Friends", not all connected users.
Clients.callbackName()
Sends a message to All Connected Clients. How do I send a message to just a few clients?

You can specify the connection id or group name. Check out the docs for more info:
http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server

To add a client to a specific group...
Groups.Add(Context.ConnectionId, "johnsFriends");
To send a message to that clients group of friends...
Clients["johnsFriends"].addMessage(message);
Then on the client side the "addMessage" method will be invoked for all clients in the group "johnsFriends".

Related

How to use SignalR with multi page web app?

The SignalR user session ends after changing the page. A new session opens on the new page.
I need a connection that will continue as long as I log out of Hub.
As far as I know, when you connect the signalR hub server, it will generate a connectionID.
Each new session will use specific connectionid, we couldn't modify the conenctionid when you used the new session.
If you want to let all the tab connect as one user account, you could try to check the username when the connection started and then store the username and connectionid as one to more in the server memory or else.
Then if other user send message to this user, you could get the connectionid according to the username and use Clients.Client(conid).SendAsync method to send the request.
More details about how to achieve it, you could refer to this reply.

How to send appointment with Azure service

Is there any service on Azure, which can be used to send meeting invite using C# code. Currently, I am sending SendGrid to send email. But I also need to send appointments (meeting invite).
Sendgrid supports email attachment, you can use this snippet in order to send an email.
Also with Azure Logic App O365 connector, you can send a calendar invitation.

Symfony swiftmailer delivery confirmation

I'd like to send emails with swiftmailer and I need confirmation of sent email and delivered.
By default swiftmailer saves emails in cache and sends them in background to prevent waiting user for sending emails.
How can I achieve confirmation of sent emails?
I think there is no way to get 100% certainty. A mail can fail to be delivered for many reasons which has nothing to do with your application. A few suggestions though:
1) You can send all mails in BCC to another address. You can do this by combining delivery_addresses and delivery_whitelist configuration parameters https://symfony.com/doc/current/reference/configuration/swiftmailer.html#delivery-whitelist
2) You can use a specific mail server under your control, so you can check its queue / logs to see which mails have been actually delivered.
3) You can set a "Read receipt" to all outbound emails.

sending mail to any website using java servlet

I am using javamail api in java servlet to send mail. It seams to send mail only to gmail Id's, whereas I want it to be able to send to any email ID. Do I require different property value here? I followed http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/ to develop the code. The property values are:
props.setProperty("mail.smtp.host", "smtp.gmail.com");
props.setProperty("mail.smtp.port", "587");
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.smtp.starttls.enable", "true");
No , There is no need to change configurations what you have ,Here it will act as server(Gmail) from there you can send mail to any mail servers(yahoo,hotmail and etc..).
You can send mail to any email ids. You can mention them in TO address or CC or BCC, check your authentications are correct.
Here is an detailed example from an existing post how to send an email from jsp/servlet?
Hope this can help you

Private chat with SignalR

I would like to know if is possible to create a chat for private conversation like gmail chat or hotmail..
How can I ensure that only client A talks with client B?
How can I ensure that only logged clients can talk?
Sure, you can create a unique "Group" each time a user initiates a chat with another user (or set of users). Then when you send messages to that group only those users would receive the message. You could also layer more security in front of sending messages to a group to ensure that the person sending the message is allowed to send a message to that group.
Try this application for Private chat with SignalR
Description of Application:
http://www.aspbucket.com/2016/03/implement-of-private-one-to-one-chat.html
Download link
https://github.com/shivam01990/SignalR-private-one-to-one-chat
Look at ChatWithTracking in Basic chat sample, that's a great starting point for IM setup
p.s: updated the link; using a search query in case they change the repo structure again
Each client connecting to a hub passes a unique connection id. You can retrieve this value in the Context.ConnectionId property of the hub context. If your application needs to map a user to the connection id and persist that mapping, you can use one of the following:
In-memory storage, such as a dictionary
SignalR group for each user
Permanent, external storage, such as a database table or Windows Azure table
http://www.asp.net/signalr/overview/hubs-api/mapping-users-to-connections

Resources