Webapp and notification - javascript

Which is the best way to notify a webapp (need to work in chrome and safari) from server? (my webapp is in angular for information).
Is it possible to receive UDP broacast with a webapp? (If not, that will not be a problem i can do a little app that will receive the broadcast and translate it to a notification but which is the best one for webapp that the question...)
This probably a double post but i didn't find a real example so if you can give me an example of what i need to do that gona be great :).

I'm not sure of what you want, but if you need to notify your webapp from server in real time you probably will be interested by websocket technology. You can get information about this subject here: https://developer.mozilla.org/fr/docs/WebSockets
If you use a nodeJs server, socket.io seems to be great and there are good exemples and documentation in the official website (http://socket.io/).

Related

Solution to controlling a network enabled POS?

I have a web app hosted on a public hosting platform. I also have a card payment terminal that is connected to my local network. I'd like for the user to click on "Pay with card" and the web app would reach out to the terminal on the client's local network and send the necessary packets.
I dug around a bit, found this SO thread, tried to go the WCF route suggested in the thread, following this tutorial, and possibly calling the WCF endpoint using Javascript's XMLHttpRequest. Is there a better way to do this? Can I somehow realiably test the WCF service in Windows? My experience with C# so far was developing a couple of really simple Console apps a couple of years back, so when it comes to Windows Services and such, I'm completely lost. Any pointers are appreciated!
WCF is an option (although it has a steep learning curve). Once you understand the concept of endpoints, contracts, clients, bindings, and service hosting in WCF you can do a lot of work with a few lines of code. This is the simplest example I could find regarding a working WCF service. If you wanna do it "the old way" you can use socket api. See an example in socket class. It is more straightforward, but you have to implement the communication protocol from scratch.
Also, you can use a WebSocket connection from the website in case the connection needs to be open for longer period of time.

peer to peer communication between mobile app and pc browser

I am working on a project where i need my mobile application to talk to my web browser on a pc, where both devices are connected over wifi. The app would send data which would be received by the computer browser followed by some client side code execution. The browser then may send some feedback.
My initial approach is to make the app talk to an endpoint which in turn talks to client side of the browser (javascript).
What could be the best approach to do this ?
Update
I am not sure if Socket.io is a possible solution since it requires a server to be hosted. Is it possible to solve this using sockets ?
You've now edited your question to mention P2P. That's quite hard to achieve PHONE TO BROWSER (i.e., by hard I mean 6 to 12 man-months of work - and/or plain not possible). However in MOST situations you can instantly (ie "one line of code on each platform") resolve the problem by using a service like pubnub. Much as nobody has back-ends anymore and everything is just done with parse.com or game center, networking like you mention is now just done with pubunb (or any competitor).
This is an extremely common use case problem - and everyone just uses PubNub as mentioned below or one of its competitors.
These days it couldn't be easier, just use pubnub.com
It's the world's biggest data-messaging service for a reason!
There's essentially no other realistic approach, it's so simple - a few lines of code.
So short answer would be: A real peer-to-peer (P2P) communication is currently not possible with all browsers. So instead you have the following options:
App + Server with a WebUI (maybe)
App + Chrome App (Chrome Apps can start an web server, see http://www.devworx.in/news/misc/chrome-apps-can-now-run-a-web-server-135711.html)
App + WebApp with Plugin (Flash, Silverlight or Java)
I personally would prefer solution 1.
You need a server. If you consider this problem strictly from the typical firewall point of view, a PC or a mobile device are going to ignore connections unless they initiate the connection themselves. So neither the PC nor the mobile device can start a connection with the other.
My understanding is that web browsers do not support standard sockets within javascript. You can use the analagous websocket, but sockets and websockets are not directly compatible.
You can setup a simple server on the PC, and have this server relay messages between the mobile device and the PC browser. Both the mobile device and the PC browser connect to the server. This is basically what an external service will do for you.
PeerJS is what you're looking for:
http://peerjs.com

how to build multi-user video chatting web app using webRTC, node.js and socket.io

im trying to make a web app that supports multi-user video chatting. ive read an article about webrtc on "getting started with webrtc"
(http://www.html5rocks.com/en/tutorials/webrtc/basics/) and done some demo on codelab. but i still dont really know how to make it a 3-way conferencing call.i dont really know a lot about node.js and socket.io. just started learning them because im trying to build this video web app.
so my question is which part of webrtc or socket.io determines that more than 2 users can join the call? or any resource that you guys get direct me to?
thanks in advance.
WebRTC is peer-to-peer protocol(browser-to-browser) without server,So you must know about my browser i must know about your browser means(your browser codec,public ip,port,etc) then only we can able to communicate,so we are using signalling(socket.io:web socket two way communication protocol send some information about my browser ,and receive some information about you browser ,with nodeJS server then peer connection will establish)
Three user communication is also possible in WebRTC using mesh network,see you send some information to me (browser information) at a same time you send this same information to other peer,when i receive some information about your i will send some information about me to you and other peer,the same thing will happen in other peer also.
Here some detail about mesh network http://en.wikipedia.org/wiki/Mesh_networking
I would say that there are two separate things here. WebRTC needs signaling to setup the peer-to-peer communication between two nodes. I think you are on the right track when using Node.js and Socket.js for this.
But it is not WebRTC (or socket.io) that decides if a third part can join the meeting, it is you that decides this. And this is the other part of the signaling that have little to do with WebRTC.
This meens that you implement functionality like setting up meetingroom, discover available meetingrooms, joining meetingrooms etc. When the three part meeting is up and running, each node will have two peer connections, one to each of the other nodes.
For N users, you need to use a media streamer like Kurento (http://www.kurento.org/)
Then you can build your own multi users webrtc solution such as: https://webrtc-chat.com/ (built on top of Kurento)
I looked at those protocols as well, not sure what node.js and sockets.io can do yet, but I think its a big mistake whatever they are doing, because all you need to do is create one place where multiple users will put their webcam images and then everybody could access the place separately to view all conversations. This has to be quick though because not a problem with video but if signal is slow then its not going to be understandable. I would try something else. I am wondering why they could not solve such an easy concept of multi-conferencing.
I have created a parody of multi-chat on my website, I cannot show you right now, but basically I save frames every 5 seconds of video and then store them (overwrite) the image saved in central folder. When somebody logs in they see all the webcams online (done with PHP). I don't know if this helps but it works and it is similar.

How does PubNub bind your account with the JavaScript API?

It seems that PubNub binds your account by domain. I can't seem to find a definitive answer in the support nor the API.
By the lack of using publish, subscribe or secret key from JavaScript it seems that your site's domain is what's bound. Is this accurate?
I haven't gotten around to playing with it, but that would be bad because that would mean that I have push up my code to the server just to test.
I need to know about this because I want a way to test my web application using local host.
You are asking about PubNub accounts and binding to a domain. This is a good question regarding how to get started with PubNub. To dispel this quickly, you do not have to provide this information with PubNub in order to connect. You can connect from Anywhere to Anywhere. You can even connect on localhost from your local system. Even better you do not need a web server and can write ordinary html5 and open the file:// from your hard disk. Pretty nifty yah?
Mac:
file:///Users/stephen/index.html
Ubuntu:
file:///home/stephen/index.html
Windows XP:
file:///C:/Documents and Settings/stephen/index.html
Windows 7:
file:///C:/Users/stephen/index.html

Help with android to chrome communication

I have been working on creating an application that sends a string from an android phone to a server and from there sending it to a Chrome extension. I am sitting with a few options to continue, I can convert everything to websockets, I can use normal sockets for android to computer and websockets for extension to server, or I can do some HTTPRequest stuff.
I am looking for suggestions on the best way to pull off this communication. I have a php server an android application and a chrome extension that need to be connected. If there is a way to connect the android application to the chrome extension without the server I would be happy to hear that too.
I need something secure and something that can be organized based on the correct person asking or sending information. So when someone sends a string from the android application the server stores it (probably using their gmail) and when the extension asks for it the server sends it along.
Also could the server just push the string to the extension without the extension calling it? This would occur after the initial websocket connection. I guess it would just store the IP address or something like that.
Any suggestions or comments would be appreciated I am just trying to make the most efficient and secure system I can come up with. I have done a significant amount of research about every aspect so I'm more suffering from information overload then anything.
Thanks in advance :]
Look into Windows Communication Foundation Services (WCF). That's what I have been using for my android applications working with a database - the .NET framework is great, and the services seem to be fairly dynamic.
http://msdn.microsoft.com/en-us/netframework/aa663324

Categories

Resources