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.
Related
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.
I need advice after looking a lot about receive push/toast notifications regardless of the status of the application (closed or open).
The application communicates with a NodeJS API.
The idea is that a user logs in once to the application and then can receive notifications (depending on his account): i the user restarts his system for example, at startup he receives notifications without having to open the application (like the Mail application for example).
Most tutorials on MSDN use Azure and I don' use this. I would like to know if you have tips or links (tutorials, ...) for doing this in an UWP (or WinRT) application.
Thanks in advance for your help.
Regards
You can send push notifications from your NodeJS api via Windows Notification Service. This service has nothing to do with azure but when using Azure Notifications Hub it will be easier to get it implemented, but again this is not required;
In essence:
- register your app in dev center
- obtain a client id and client secret to use WNS in the dev center
- When your app launch it obtains a push notification channel uri and sends this to your backend. Your backend need to save all the URI's for the different devices
- When you have a notification select the uri's of the devices you want to send the push notification to
- post a xml message (based on what you want to update, tile, toast, badge or raw) to the URI's. To be able to post you need to authenticatie with the client id and client secret
more detailed read: https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/tiles-and-notifications-windows-push-notification-services--wns--overview#
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.
I'm playing with the idea of having a completely decoupled HTML5 frontend, but still user authentication for a web app. Is this possible or will I run into some heavy browser security issues?
The idea is to have all static content delivered through a CDN on like example.com, and having it fetch dynamic data (and user authentication) through a separate subdomain, like api.example.com.
This would speed up the loading time of the site, and I could keep the frontend stuff in a completely separate repo so that the developers don't have to worry about setting up the backend to develop and test new features.
Is this already possible in some JS framework perhaps, backbone.js, angular.js, ember.js, knockout.js ?
It definitely is, but I think it is more about approach rather than technology. I have implemented what you describe for a project (it's online but don't want to do a shameless plug here, if interested to check it out I can post the link). My stack is java in the backend exposing a REST api for both autentication and business logic. The client is a backbone.js application. I explicitely decided NOT to use sessions at all. It is completely stateless. This of course means that the user must be re-authenticated at every request.
When the user logs in through a slightly modified OAuth endpoint, it gets a token that must be passed at every request. Cookie works in this case as they are handled automatically by the browser. If not passed as cookie, the backend expect it as a parameter. The frontend communicates using the REST endpoints. It's a single-page application, full client side, this means that the backend serves a page that is basically empty, that include few JS files that are the application itself. No other pageload occurs. Logout is done by simply deleting the cookie or not sending the authToken, the server cannot and doesn't have to "forget" about the user. Token are nice as they can be invalidated, both expilcitely or by changing the password. I've chosen this approach as it made it easy to develop desktop app and browser plugin for my webapp without touching a single line of backend code.
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/