Servicestack server sent events - email application - c#

Can anyone guide me, where to find servicestack server sent event sample code.
First I explain my issue. I have created a restful service(using servicestack framework) to pull down list of emails for inbox folder using afterlogic mailbee object(external product). Now, each time if I do a pull, it takes more time to load list of emails because I am pulling down message body too.
Now I want to send down list of message headers first in the service, and then want the message body to load, because it take more time to pull down from imap object. I see server sent event is the only option here. If someone has a better solution for this, please suggest.
Now, if I have to use servicestack server sent events, I am unable to get any sample code, which I can look upon to implement in my case.
Please ask, if there is more clarification needed in my question.
Thanks for your time.

There is a sample for your requirement.
It is called Chat (it uses SSE).
Otherwise another project called EmailContacts can help you to develop the email app.

Server Events is to enable server/push real-time communication, if you want to optimize page loads you should separate your calls into 2 Services:
Fetch absolute minimum to render page
Fetch full details on demand

Related

Read logs from within an Azure Function

I have an Azure function that runs a few times a day. I'd like to email myself a daily list of log messages, and wondered if I could use another Azure function for that?
Is it possible to read an Azure function logs from within an Azure function? Or is there another way to achieve the above?
Or is there another way to achieve the above?
Yes, you can use Azure Logic apps to get the logs of Function app recurrently.
I have created a logic app in Consumption plan, then created a workflow with Recurrence Trigger like below:
Then in next step I have chosen the Azure Applications insights like below:
Then I have opted send an email action and then I got the logs to my email :
Then in email I received logs:
I would propose two possible solutions in the realm of Azure.
In both cases I would suggest to include application insights.
It is a general recommendation by Microsoft.
Then goes what Peter Bons called "use case".
If it is enough for you get the critical information about recurring issues with N minutes of frequency, then you could make us of alerts. Last time I checked one needed to pay extra for each email, please double-check that.
If for some reason you want to have more control over what logs you want to send and fetch, you can fetch data directly from application insights through the REST API. To complete the idea you could use bindings that allow send emails (see here for practical points). I would say that there variations on how you can achieve fetching data, although the feature will be deprecated in two years.

Add request function to CRUD model that sends an email

I have no background in programing, but my job wants me to learn. I have built a simple .asp mvc project that is a database of movies and such. I need a request form for a movie that can be filled out and if that movie is added then the client would be sent an email. Can anyone give me an idea on how I could accomplish this task. Thank you for anyone who has time to even point me in the right direction.
It's pretty straightforward to do … you need to:
get data from form (seems you already have the form)
check with db if movie added (use Entity Framework, or some other ORM)
send email based on result (You can use services for this -- sendgrid, I think twilio does it, or you can just use an smtp client if you already have a server address) …
Search/learn for each of these individually to get your project complete.

Receive notification in ASP.net if table from SQL was Updated/Changed

Is it possible to get notification in my ASP.net Website from database if a table was been modified?
Example: if there is new message that come to my account. It will notify me on my website. I've tried to use ajax on this kind of feature but I want a better solution on this. AJAX is keep on requesting/communicating on the server even there is not new update on my table that why I find it not that good.
Please Help me on this problem.
What technology I should use? or please give me some related article.
Thanks!
No, it is not possible to get notification to your ASP.NET Website without an ajax request which keeps on communicating to a server in a given time interval. You can use SQL triggers to get information that your table has been updated or row has been added/deleted but to get that information too you'll need to make a request to your database server. I haven't came across any architecture in which database server automatically communicates to your web application/website until and unless a request is made by web application/website.

Alert Selected users SignalR

I am looking into an alternative solution to my jQuery and Ajax alerting feature in my MVC4 app. I have stumbled across SignalR which looks like it can solve my solution but where I hear you can broadcast to a certain client and not all, I cannot seem to find an example.
Basically all I want to know is:
On set up can the clientID be the applications UserID on login?
Are you able to broadcast to specific roles and/or a list of userID's
Are there are any examples that can help demonstrate the above?
Thanks in advance
With SignalR you can manage your own user identities. SignalR represents each user with a ConnectionId but it is ultimately up to the dev to map that to an existing user profile.
Yes, you are able to broadcast to groups or specific clients. You can add clients to groups and then send single messages to multiple people simultaneously or you can send to a specific client.
As noted in the comment JabbR is an excelent example. Also for a quick start on getting introduced to SignalR check out the Quick Start Hubs page. Lastly SignalR is open source so check out the source and the wiki.

Asp.Net "Instant" PM System

I need to send "instant" messages (like forum PMs) between users with my asp.net application. As many others I use a webhotel to host my site. I have searched around for awhile and I can't find any solutions that would be a good fit with my system. I was thinking about writing a javascript that would call for each 30 seconds or so a .ashx handler to check the users message status (return true or false) if the correct credentials are supplied. However I dont know if this is a good solution, because of all the calls to the handler it might get picked up as spam or it might generate really bad performance? The thing is, I want to avoid the need to refresh the page just to see your latest messages.
Take a look at the C# SignalR library, it allows you send grouped or broadcast messages to clients using longpolling or websockets with minimal bandwidth and simple code
http://signalr.net/
You can use an updatepanel for this. Put a textbox in an updatepanel in your page. When a user sends a message just append it to that textbox.You can put a refresh timer to refresh the contents in every second .

Categories