can we use Server Sent Event (HTML5) with WCF - html

How can i use server sent events with WCF?
To be specific:
how to make wcf broadcast and send data continuously to client.
How to consume those information in HTML5 page.

No you cannot.
What you are asking for is not possible.
You can send data to WCF clients via callbacks over duplex bindings, but this is not receivable from javascript, only WCF clients.
Or you can send data to client side javascript code using SignalR, which is an implementation of server sent events.

Related

Is it possible to send a message to a SQS Queue upon a HTML website button press?

I am trying to find a way to connect SQS with a website.
My general understanding of the project is that when a user clicks a button on the website it will send a message to the queue, and then I will have an Arduino receiving the message, which will then trigger a function that will move a robot. I have played around with Temboo and have managed to receive messages on the Arudino board, but I have no idea if it is even possible to send messages through a HTML button press. Is this even doable?
One way to send messages to SQS from a web browser is to use the AWS JavaScript SDK in the browser. You will need to supply credentials to the browser client so that it can make SDK calls, so ideally your client authenticates to your back-end and your back-end can send temporary (STS) credentials down to the client to use with the SDK.
Or you can use Amplify Pub/Sub, which is a higher-level framework than the AWS SDK.
Another way would be to create a small Lambda function, fronted with API Gateway, and then your browser client can POST to an HTTPS endpoint that will trigger your Lambda function to send the message to SQS.

push notification in ExtJS

I am developing a HTMl5 based application using ExtJS. The server is pushing messages whenever updates comes. In this app, I have to implement push notification (instead set timer to get updated messages from server periodically).
Is there way to implement push notification using ExtJS or using any JavaScript framework?
--Sridhar
Yes, you can use WebSocket technology for this purpose which allows a server and an ExtJS client communicate over a full-duplex TCP connection. Here is an ExtJS WebSocket component: https://github.com/wilk/ExtJS-WebSocket
It also provides event-driven communication and message broadcasting to multiple peers which exactly fits the requirements of implementing push notiication.

Client Side Only standalone Smtp Client/relay, for sending mails directly

Usually, when you send an e-mail (with Thunderbird or Outlook), you don't send it directly.
example: I have a gmail address and I want to send an e-mail to a myopera address. The process will be:
user->gmail server(gmail-smtp-in.l.google.com)->myopera server(in1.smtp.messagingengine.com)->final user who'll download it's email with pop/imap.
One of the inconvenient is the size: Imagine you have attachment of 50Mb: the limit of myopera is 60MB; but the limit of gmail is 25MB,So the mail will be refused whereas it would be accepted if it was send directly to myopera.
But I saw with telnet that, it is possible to send mail directly with SMTP commands.
I want to write a client-side Only web application which would convert a mail in a set of SMTP commands for sending it. I should be very basic and not support encryption
I don't know how to create a TCP connection from a client, so, here's my questions: Does a library already exist? If not, what I should use? I've read about the existence of WebSockets but that Ajax would be more universal.
Also, most of the actuals implementations of WebSocket I saw, don't work in my latests versions of web browser despite the fact they 'support it'. There's also the raw Socket API from the W3c (I've no idea of the web browsers which actually support it).So, I would like to not avoid statements telling it is impossible to create near raw TCP/UDP session. Since it is possible, I can't imagine nobody created a kind of library for dealing with protocols
You should take an alternative route.
If i had that issue i would still use a server side component of some sort, and just have the server contact to receiving mail server directly.
Given the email: "someuser#somedomain.tld" you could do a DNS MX record lookup on "somedomain.tld" and find the receiving mail server say "mail.somedomain.tld", then you could tell your mail send component to send the email directly to "mail.somedomain.tld", that way you would have an immediate feedback on whatever the mail went through or not.
For Objective-C you may use https://github.com/jetseven/skpsmtpmessage
By looking at the source you see how SMTP works.

Is it possible to make Websocket as a REST instead of SOAP????

Is there any way to make a websocket as a REST service and host it in IIS..IIS8 only supports websocket with NetHttpBinding. and access from a client who has a proxy implemented for the service...But I want to have Websocket with REST..so that I can access that service from my android App and my HTML5 Client. Is that possible..???
I have a rest service in my project which serves data as per requirement.
1.RegisterTag(TagName);
2.value GetValue();
Now I have to have a callback from the service. First I have to call the RegisterTag(MyTagName). and then I should get notification from the server side.It is implemented with the Server sent events. But now I need to convert this REST service to websocket.
So, is it possible to add REST feature in WebSocket ?? I am planning to add NetHttpBinding in my new implementation.
Thanks
Arijit
have a look at this
Is ReST over websockets possible?
http://www.kimchy.org/rest_and_web_sockets/
REST does not require any specific protocol so it is possible to use websockets if you like.
"One thing that confuses people, is that REST and HTTP seem to be hand-in-hand. After all, the world-wide-web itself runs on HTTP, and it makes sense, a RESTful API does the same. However, there is nothing in the REST constraints that makes the usage of HTTP as a transfer protocol mandatory. It's perfectly possible to use other transfer protocols like SNMP, SMTP and others to use, and your API could still very well be a RESTful API"
http://restcookbook.com/Miscellaneous/rest-and-http/

mysql to android using soap

i know very well that android not support the mysql
but i need to connect mysql and get the information from database
i studied there are SOAP and REST services to connect mysql from android
is it possible?then give me one idea and if possible one example pls
i need to connect mysql and get the
information from database
You can get the data from the database with or without connecting to it. You can get it with or without SOAP. An agent on the server, usually a CGI sript makes the database request on the client's behalf. In SOAP, the the query and response are often encoded in XML, and always transmitted by standard Internet methods such as HTTP or SMTP.
Non SOAP methods include CORBA, simple RPC, and home-grown solutions. If the database is open to the Internet, then a direct connection to the database port on the server is possible.
It's only the security restrictions that limit what you can do. In an environment where only mail, HTTP and FTP are possible, SOAP is a good protocol. If the client is actually a web browser, then AJAX is ideal.
For a typical data request, all you need to know is the URL (and associated protocol) on the server to query for the data. For example, using HTTP:
http://dataserer.example.com/chart_data.cgi?chart_num=2
The server-side script, chart_data.cgi reads the query (from a GET request in this case), retrieves the information from the database and sends it, encoded in XML, back to the client, simply by writing the HTTTP header and XML content to standard output. It is Javascript and a browser protocol XMLHttpRequest that make the HTML request and XML receipt possible.
So even in Android, when you browse the web and see all that information, on Amazon for example. A lot of that information is retrieved by agents at Amazon from their database, formatted for the client(the browser on Android) and sent back to the client. No Android-specific coding is required.
Use a custom remote agent such as a CGI script on a server to access a remote database. Android only needs to communicate with the agent.
Write a SOAP server using the language of your choice:
Google: Soap Server
Call it from Android:
How to call web service with Android
Of course, you don't have to do it in SOAP. You can just output the data from your web service in any format like JSON, plain text, XML, CSV, (or even HTML?) ... and consume it from Android.