How can I send message in Azure event hub directly from browser? - azure-eventhub

I have to send a message in Azure event hub directly from browser. Is there any library which works purely on browser or do I have to just use Event Hub service REST?

The #azure/event-hubs package supports use on the browser for some scenarios, including publishing events.
This sample covers the send-from-browser details. The set of all browser-focused samples can be found here.

Related

Oracle Apex and Twilio API

I am trying to have my application use Twilio's SMS API to send a text message to a user's phone when they complete a certain action. What is the general process for doing this in Oracle Apex?
These are just two of a few posts out there on sending SMS from the database.
https://www.jmjcloud.com/blog/sms-messaging-from-oracle-erp-with-ords-and-twillio
https://jeffkemponoracle.com/2016/08/send-sms-mms-and-voice-messages-from-oracle-plsql/
It usually requires something along the lines of
signing up for service
installing a PL/SQL package
enabling database ACL for the relevant host
invoking some PL/SQL to send the SMS

Does Outlook.com provides any webhook/push-notification support?

I'm planning to write a web service to automate some task for my Outlook.com email account. I want Outlook.com to send an HTTP request to my endpoint when an email arrives, so that I don't need to poll the server. Does Outlook.com provide such functionality?
That API has been deprecated.
You must use: microsoft graph
Outlook provides webhooks via what they call push notifications. You'll find details on this API in the Outlook Push Notifications REST API reference. The capability exists to receive events for a wide variety of resources, including email messages in Outlook.com.
You might also find some useful capabilities for notification of changes to messages with Use the Microsoft Graph API to get change notifications and Keeping messages and mail folders up to date in apps.

Service Worker: handle requests when offline to send them when online

I have a chat web application and I want it to work offline. For this I use progressive web apps features (Service Workers) to use cache to get the shell app and the messages already loaded.
What I want to do is to be able to make a post message when I'm offline and let the service worker handle the connection issues (i.e.: keep the message somewhere till where are offline and as soon as we are online send the Post message).
I want to use Service Worker because I also want to send the message if the user as left the web app after posting a message with no connection.
What is the best API to use for this?
I saw the background sync API but it is not standard and it doesn't seem to be updated for almost 2 years.
If there is a way to do this in a manner that the client (the web app) is totally unaware of this mechanism it would be cool.
What I mean by that is I would like my app just do a
fetch("/message", {method : "post", body : {content : "hey there"})
And then the Service Worker just intercept the fetch, if we are online then it just send the fetch, but if we are offline it "wait" for the connection to be up again and then send the post.
I wonder if there is an event listener, available in the service worker, that will be activated when the connection change from offline to online. This way I should be able to store the request in indexDB when offline and then send the post when online.
I saw the navigator.onLine but it is not an event :(
Based from this post, you may use a Service Worker in running the app in the background either via its push event handler (triggered via an incoming push message), or via its sync event handler (triggered by an automatic replay of a task that previously failed).
You may check the Offline Storage for Progressive Web Apps documentation for storing data offline:
For URL addressable resources, use the Cache API (part of service workers).
For all other data, use IndexedDB (with a promises wrapper).
You can cache static resources, composing your application shell (JS/CSS/HTML files) using the Cache API and fill in the offline page data from IndexedDB.

Firebase architecture

I currently have a server running in Django and a frontend in Angular 2. I'm planning to build a chat messaging using Firebase but I don't know if I should call the saving of data directly in client or send it first in my server and do the calls there.
1) Client sends a message -> Firebase
If I structure it like this, any users can have a read and write access on the database
2) Client sends a message -> My Server (Using a service account) -> Firebase
And if I structure it like this, clients will only have a read access so they can only subscribe but not send any message.
What's the ideal way of doing it?
Thank you
Firebase is meant for the Client sends a message -> Firebase Architecture.
It is your responsibility to setup Rules correctly in Firebase so that read and write access on the database is based upon their Role/Authentication etc.
you may read more about configuring rules at Firebase : Security & Rules Quickstart

Sending SQL emails using AWS and SES

I hope someone will be able to help me with this since I am new with AWS stuff.
I have a Web App using .NET MVC which will be deployed/hosted in AWS. This is the description of what I would like to achieve:
1- Let's say that the Web App will insert products in a Products Table on SQL Server.
2- When this product is inserted, the system (AWS) will send an email to a Client from a Clients Table on SQL Server.
Is that possible with AWS?
Could I set a trigger in SQL Server and send an email by SES?
Is it better to use SQS?. So the Web App will publish messages in SQS, and then having another app listening and sending those emails, for instance a console app.
I will appreciate any direction or useful link.
Thanks all of you in advance.
The answer to your first question is 'yes'. Yes SQL server can use SES to send emails. Because SQL server can send emails, all you need to do is set it up to use the correct SMTP settings from SES once your account is verified and working with SES.
That said, I would never have my db server send emails, just doesn't seem like the right place to do it; even though you can.
I have developed and support several systems like this, and the usual pattern I use is to have the web application insert a message in an SQS queue that will be used as input to another process to send the email out. When possible I like to include all the details about the email into the SQS message, i.e. from, to, subject and the body - everything the downstream process will need to know to send them out.
In my case I use a windows service running on several EC2 instances in an autoscale group to poll the queue and send the emails out. In most cases, where I was able to store all the emails in the SQS body, the windows service is completely general purpose - it reads an SQS message, composes the email and sends it out. Because all of the details of the email are within the SQS message body, this single SQS queue and the windows service that is processing it, can process emails from a variety of applications because the service doesn't need to contain any business logic specific to the application and has no external dependencies.
As you talk about separation of responsibilities, I can't see anything less indicated to send email than a db server (even if it can do it).Sending emails is a task for your business layer, surely not for the data layer.
Use the web app to trigger the process of sending the emails, than implement it directly into the web app, or separate it with a messaging system (like SNS), with a queue system (like SQS) or whatever else.